哪里错了?????

P1093 [NOIP2007 普及组] 奖学金

Drind @ 2020-02-03 10:18:54


#include<iostream>
using namespace std;
int main()
{
    int n,y[301],s[301],e[301],z[301],max[3][6],i,j;
    cin>>n;
    for(i=1;i<=n;i++)
    {
        cin>>y[i]>>s[i]>>e[i];
        z[i]=y[i]+s[i]+e[i];
    }
    for(j=1;j<=5;j++)
    {
        max[1][j]=z[1];
        max[2][j]=1;
        max[3][j]=y[1];
        for(i=2;i<=n;i++)
        {
            if (z[i]==max[1][j])
            {
                if (max[3][j]<y[i])
                {
                    max[1][j]=z[i];
                    max[2][j]=i;
                    max[3][j]=y[i];
                }
                if (max[3][j]==y[i])
                {
                    if (max[2][j]>i)
                    {
                        max[1][j]=z[i];
                        max[2][j]=i;
                        max[3][j]=y[i];
                    }
                }
            }
            if (z[i]>max[1][j])
            {
                max[1][j]=z[i];
                max[2][j]=i;
                max[3][j]=y[i];
            }
        } 
        cout<<max[2][j]<<" "<<max[1][j]<<endl;
        z[max[2][j]]=0;
    }
    return 0;
}

by Drind @ 2020-02-03 10:19:34

我下载了数据1,没错啊(我不知道怎么发图片Sorry)


by Resonaa @ 2020-02-03 10:23:07

@HShongshi 把max换成maxx试试。


by Drind @ 2020-02-03 10:25:45

@kevinhou emmmm,我下载数据比对都没问题,(难道洛谷不能用max?)


by lbw_gsxt @ 2020-02-03 10:26:57

@HShongshi 你可以用max的


by Resonaa @ 2020-02-03 10:27:10

@HShongshi 不是编译失败吗?


by Drind @ 2020-02-03 10:28:18

80分awa


by Drind @ 2020-02-03 10:29:08

不然你们把代码复制贴上去答题,真的80分


by Drind @ 2020-02-03 10:30:20

测试点信息 3ms/812.00KB WA

1

Wrong Answer. wrong answer On line 5 column 1, read 7, expected 3. 2ms/712.00KB WA

2

Wrong Answer. wrong answer On line 5 column 1, read 5, expected 3. 4ms/520.00KB AC

3

Accepted, 得分 10. ok accepted 2ms/712.00KB AC

4

Accepted, 得分 10. ok accepted 3ms/664.00KB AC

5

Accepted, 得分 10. ok accepted 2ms/676.00KB AC

6

Accepted, 得分 10. ok accepted 4ms/668.00KB AC

7

Accepted, 得分 10. ok accepted 2ms/704.00KB AC

8

Accepted, 得分 10. ok accepted 4ms/708.00KB AC

9

Accepted, 得分 10. ok accepted 3ms/712.00KB AC

10

Accepted, 得分 10. ok accepted


by 深度优先搜索 @ 2020-02-03 10:31:55

你排序了吗?


by Resonaa @ 2020-02-03 10:32:07

@HShongshi

编译失败

/tmp/tmpxv2ezs4f/src: 在函数‘int main()’中:

         max[1][j]=z[1];
         ^~~
In file included from /usr/include/c++/8/bits/char_traits.h:39,
                 from /usr/include/c++/8/ios:40,
                 from /usr/include/c++/8/ostream:38,
                 from /usr/include/c++/8/iostream:39,
                 from /tmp/tmpxv2ezs4f/src:1:
/usr/include/c++/8/bits/stl_algobase.h:265:5: 附注:备选为: ‘template<class _Tp, class _Compare> const _Tp& std::max(const _Tp&, const _Tp&, _Compare)’
     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
     ^~~
/usr/include/c++/8/bits/stl_algobase.h:219:5: 附注:         ‘template<class _Tp> const _Tp& std::max(const _Tp&, const _Tp&)’
     max(const _Tp& __a, const _Tp& __b)
     ^~~
/tmp/tmpxv2ezs4f/src:3:35: 附注:         ‘int max [3][6]’
 int n,y[301],s[301],e[301],z[301],max[3][6],i,j;
                                   ^~~
/tmp/tmpxv2ezs4f/src:16:9: 错误:对‘max’的引用有歧义
         max[2][j]=1;
         ^~~
In file included from /usr/include/c++/8/bits/char_traits.h:39,
                 from /usr/include/c++/8/ios:40,
                 from /usr/include/c++/8/ostream:38,
                 from /usr/include/c++/8/iostream:39,
                 from /tmp/tmpxv2ezs4f/src:1:
/usr/include/c++/8/bits/stl_algobase.h:265:5: 附注:备选为: ‘template<class _Tp, class _Compare> const _Tp& std::max(const _Tp&, const _Tp&, _Compare)’
     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
     ^~~
/usr/include/c++/8/bits/stl_algobase.h:219:5: 附注:         ‘template<class _Tp> const _Tp& std::max(const _Tp&, const _Tp&)’
     max(const _Tp& __a, const _Tp& __b)
     ^~~
/tmp/tmpxv2ezs4f/src:3:35: 附注:         ‘int max [3][6]’
 int n,y[301],s[301],e[301],z[301],max[3][6],i,j;
                                   ^~~
/tmp/tmpxv2ezs4f/src:17:9: 错误:对‘max’的引用有歧义
         max[3][j]=y[1];
         ^~~
In file included from /usr/include/c++/8/bits/char_traits.h:39,
                 from /usr/include/c++/8/ios:40,
                 from /usr/include/c++/8/ostream:38,
                 from /usr/include/c++/8/iostream:39,
                 from /tmp/tmpxv2ezs4f/src:1:
/usr/include/c++/8/bits/stl_algobase.h:265:5: 附注:备选为: ‘template<class _Tp, class _Compare> const _Tp& std::max(const _Tp&, const _Tp&, _Compare)’
     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
     ^~~
/usr/include/c++/8/bits/stl_algobase.h:219:5: 附注:         ‘template<class _Tp> const _Tp& std::max(const _Tp&, const _Tp&)’
     max(const _Tp& __a, const _Tp& __b)
     ^~~
/tmp/tmpxv2ezs4f/src:3:35: 附注:         ‘int max [3][6]’
 int n,y[301],s[301],e[301],z[301],max[3][6],i,j;
                                   ^~~
/tmp/tmpxv2ezs4f/src:20:23: 错误:对‘max’的引用有歧义
             if (z[i]==max[1][j])
                       ^~~
In file included from /usr/include/c++/8/bits/char_traits.h:39,
                 from /usr/include/c++/8/ios:40,
                 from /usr/include/c++/8/ostream:38,
                 from /usr/include/c++/8/iostream:39,
                 from /tmp/tmpxv2ezs4f/src:1:
/usr/include/c++/8/bits/stl_algobase.h:265:5: 附注:备选为: ‘template<class _Tp, class _Compare> const _Tp& std::max(const _Tp&, const _Tp&, _Compare)’
     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
     ^~~
/usr/include/c++/8/bits/stl_algobase.h:219:5: 附注:         ‘template<class _Tp> const _Tp& std::max(const _Tp&, const _Tp&)’
     max(const _Tp& __a, const _Tp& __b)
     ^~~
/tmp/tmpxv2ezs4f/src:3:35: 附注:         ‘int max [3][6]’
 int n,y[301],s[301],e[301],z[301],max[3][6],i,j;
                                   ^~~
/tmp/tmpxv2ezs4f/src:22:21: 错误:对‘max’的引用有歧义
                 if (max[3][j]<y[i])
                     ^~~
In file included from /usr/include/c++/8/bits/char_traits.h:39,
                 from /usr/include/c++/8/ios:40,
                 from /usr/include/c++/8/ostream:38,
                 from /usr/include/c++/8/iostream:39,
                 from /tmp/tmpxv2ezs4f/src:1:
/usr/include/c++/8/bits/stl_algobase.h:265:5: 附注:备选为: ‘template<class _Tp, class _Compare> const _Tp& std::max(const _Tp&, const _Tp&, _Compare)’
     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
     ^~~
/usr/include/c++/8/bits/stl_algobase.h:219:5: 附注:         ‘template<class _Tp> const _Tp& std::max(const _Tp&, const _Tp&)’
     max(const _Tp& __a, const _Tp& __b)
     ^~~
/tmp/tmpxv2ezs4f/src:3:35: 附注:         ‘int max [3][6]’
 int n,y[301],s[301],e[301],z[301],max[3][6],i,j;
                                   ^~~
/tmp/tmpxv2ezs4f/src:24:21: 错误:对‘max’的引用有歧义
                     max[1][j]=z[i];
                     ^~~
In file included from /usr/include/c++/8/bits/char_traits.h:39,
                 from /usr/include/c++/8/ios:40,
                 from /usr/include/c++/8/ostream:38,
                 from /usr/include/c++/8/iostream:39,
                 from /tmp/tmpxv2ezs4f/src:1:
/usr/include/c++/8/bits/stl_algobase.h:265:5: 附注:备选为: ‘template<class _Tp, class _Compare> const _Tp& std::max(const _Tp&, const _Tp&, _Compare)’
     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
     ^~~
/usr/include/c++/8/bits/stl_algobase.h:219:5: 附注:         ‘template<class _Tp> const _Tp& std::max(const _Tp&, const _Tp&)’
     max(const _Tp& __a, const _Tp& __b)
     ^~~
/tmp/tmpxv2ezs4f/src:3:35: 附注:         ‘int max [3][6]’
 int n,y[301],s[301],e[301],z[301],max[3][6],i,j;
                                   ^~~
/tmp/tmpxv2ezs4f/src:25:21: 错误:对‘max’的引用有歧义
                     max[2][j]=i;
                     ^~~
In file included from /usr/include/c++/8/bits/char_traits.h:39,
                 from /usr/include/c++/8/ios:40,
                 from /usr/include/c++/8/ostream:38,
                 from /usr/include/c++/8/iostream:39,
                 from /tmp/tmpxv2ezs4f/src:1:
/usr/include/c++/8/bits/stl_algobase.h:265:5: 附注:备选为: ‘template<class _Tp, class _Compare> const _Tp& std::max(const _Tp&, const _Tp&, _Compare)’
     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
     ^~~
/usr/include/c++/8/bits/stl_algobase.h:219:5: 附注:         ‘template<class _Tp> const _Tp& std::max(const _Tp&, const _Tp&)’
     max(const _Tp& __a, const _Tp& __b)
     ^~~
/tmp/tmpxv2ezs4f/src:3:35: 附注:         ‘int max [3][6]’
 int n,y[301],s[301],e[301],z[301],max[3][6],i,j;
                                   ^~~
/tmp/tmpxv2ezs4f/src:26:21: 错误:对‘max’的引用有歧义
                     max[3][j]=y[i];
                     ^~~
In file included from /usr/include/c++/8/bits/char_traits.h:39,
                 from /usr/include/c++/8/ios:40,
                 from /usr/include/c++/8/ostream:38,
                 from /usr/include/c++/8/iostream:39,
                 from /tmp/tmpxv2ezs4f/src:1:
/usr/include/c++/8/bits/stl_algobase.h:265:5: 附注:备选为: ‘template<class _Tp, class _Compare> const _Tp& std::max(const _Tp&, const _Tp&, _Compare)’
     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
     ^~~
/usr/include/c++/8/bits/stl_algobase.h:219:5: 附注:         ‘template<class _Tp> const _Tp& std::max(const _Tp&, const _Tp&)’
     max(const _Tp& __a, const _Tp& __b)
     ^~~
/tmp/tmpxv2ezs4f/src:3:35: 附注:         ‘int max [3][6]’
 int n,y[301],s[301],e[301],z[301],max[3][6],i,j;
                                   ^~~
/tmp/tmpxv2ezs4f/src:28:21: 错误:对‘max’的引用有歧义
                 if (max[3][j]==y[i])
                     ^~~
In file included from /usr/include/c++/8/bits/char_traits.h:39,
                 from /usr/include/c++/8/ios:40,
                 from /usr/include/c++/8/ostream:38,
                 from /usr/include/c++/8/iostream:39,
                 from /tmp/tmpxv2ezs4f/src:1:
/usr/include/c++/8/bits/stl_algobase.h:265:5: 附注:备选为: ‘template<class _Tp, class _Compare> const _Tp& std::max(const _Tp&, const _Tp&, _Compare)’
     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
     ^~~
/usr/include/c++/8/bits/stl_algobase.h:219:5: 附注:         ‘template<class _Tp> const _Tp& std::max(const _Tp&, const _Tp&)’
     max(const _Tp& __a, const _Tp& __b)
     ^~~
/tmp/tmpxv2ezs4f/src:3:35: 附注:         ‘int max [3][6]’
 int n,y[301],s[301],e[301],z[301],max[3][6],i,j;
                                   ^~~
/tmp/tmpxv2ezs4f/src:30:25: 错误:对‘max’的引用有歧义
                     if (max[2][j]>i)
                         ^~~
In file included from /usr/include/c++/8/bits/char_traits.h:39,
                 from /usr/include/c++/8/ios:40,
                 from /usr/include/c++/8/ostream:38,
                 from /usr/include/c++/8/iostream:39,
                 from /tmp/tmpxv2ezs4f/src:1:
/usr/include/c++/8/bits/stl_algobase.h:265:5: 附注:备选为: ‘template<class _Tp, class _Compare> const _Tp& std::max(const _Tp&, const _Tp&, _Compare)’
     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
     ^~~
/usr/include/c++/8/bits/stl_algobase.h:219:5: 附注:         ‘template<class _Tp> const _Tp& std::max(const _Tp&, const _Tp&)’
     max(const _Tp& __a, const _Tp& __b)
     ^~~
/tmp/tmpxv2ezs4f/src:3:35: 附注:         ‘int max [3][6]’
 int n,y[301],s[301],e[301],z[301],max[3][6],i,j;
                                   ^~~
/tmp/tmpxv2ezs4f/src:32:25: 错误:对‘max’的引用有歧义
                         max[1][j]=z[i];
                         ^~~
In file included from /usr/include/c++/8/bits/char_traits.h:39,
                 from /usr/include/c++/8/ios:40,
                 from /usr/include/c++/8/ostream:38,
                 from /usr/include/c++/8/iostream:39,
                 from /tmp/tmpxv2ezs4f/src:1:
/usr/include/c++/8/bits/stl_algobase.h:265:5: 附注:备选为: ‘template<class _Tp, class _Compare> const _Tp& std::max(const _Tp&, const _Tp&, _Compare)’
     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
     ^~~
/usr/include/c++/8/bits/stl_algobase.h:219:5: 附注:         ‘template<class _Tp> const _Tp& std::max(const _Tp&, const _Tp&)’
     max(const _Tp& __a, const _Tp& __b)
     ^~~
/tmp/tmpxv2ezs4f/src:3:35: 附注:         ‘int max [3][6]’
 int n,y[301],s[301],e[301],z[301],max[3][6],i,j;
                                   ^~~
/tmp/tmpxv2ezs4f/src:33:25: 错误:对‘max’的引用有歧义
                         max[2][j]=i;
                         ^~~
In file included from /usr/include/c++/8/bits/char_traits.h:39,
                 from /usr/include/c++/8/ios:40,
                 from /usr/include/c++/8/ostream:38,
                 from /usr/include/c++/8/iostre
...
          ···

| 下一页