QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#809461#9788. ShrecklessAfterlife#WA 21ms3616kbC++20903b2024-12-11 15:13:352024-12-11 15:13:37

Judging History

你现在查看的是最新测评结果

  • [2024-12-11 15:13:37]
  • 评测
  • 测评结果:WA
  • 用时:21ms
  • 内存:3616kb
  • [2024-12-11 15:13:35]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;

int T;

int n,m;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin>>T;
    while(T--)
    {
        cin>>n>>m;
        vector<vector<int> >a(n,vector<int>(m));
        for(auto &v:a)
            for(auto &x:v)
                cin>>x;
        int cnt=0;
        multiset<int> s;
        for(int j=m-1;j>=0;j--)
        {
            vector<int> v;
            for(int i=0;i<n;i++)
                v.push_back(a[i][j]);
            sort(v.begin(),v.end());
            vector<int> nw;
            for(auto x:v)
            {
                if(s.size()&&*s.begin()<x)
                    cnt++,s.erase(s.begin());
                else
                    nw.push_back(x);
            }
            for(auto x:nw)
                s.insert(x);
        }
        cout<<(cnt>=n?"YES\n":"NO\n");
    }
}

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 3544kb

input:

3
2 2
69 69
2024 42
3 3
1 1 1
1 1 1
2 2 2
3 4
1 1 1 1
1 1 1 1
2 2 2 2

output:

YES
NO
YES

result:

ok 3 token(s): yes count is 2, no count is 1

Test #2:

score: 0
Accepted
time: 0ms
memory: 3492kb

input:

3
2 2
69 69
2024 42
3 3
1 1 1
1 1 1
2 2 2
3 4
1 1 1 1
1 1 1 1
2 2 2 2

output:

YES
NO
YES

result:

ok 3 token(s): yes count is 2, no count is 1

Test #3:

score: -100
Wrong Answer
time: 21ms
memory: 3616kb

input:

20000
6 2
12 4
8 24
2 10
1 22
3 15
18 20
3 3
3 8 18
2 17 15
13 4 6
3 3
7 17 15
8 6 3
18 13 9
3 3
2 3 14
1 7 17
4 6 13
3 3
6 10 14
3 9 13
1 7 15
2 4
1 3 16 14
6 10 4 2
3 3
3 2 17
7 11 13
16 5 18
2 3
2 3 6
4 1 5
2 4
4 6 13 14
2 11 12 16
3 3
2 8 12
4 9 17
5 7 18
3 2
5 10
8 9
1 6
2 2
2 4
1 3
2 3
12 6 1
...

output:

NO
YES
YES
NO
NO
YES
YES
YES
NO
NO
NO
NO
YES
YES
YES
YES
NO
NO
YES
NO
NO
NO
YES
NO
YES
YES
YES
YES
YES
NO
NO
YES
NO
YES
NO
NO
YES
NO
YES
YES
NO
NO
YES
NO
YES
NO
NO
YES
YES
YES
NO
NO
NO
YES
YES
YES
NO
NO
NO
YES
NO
NO
YES
NO
NO
NO
YES
YES
YES
YES
NO
NO
YES
NO
NO
NO
NO
NO
YES
YES
YES
NO
NO
YES
YES
NO
N...

result:

wrong answer expected YES, found NO [610th token]