QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#812604 | #9788. Shreckless | ucup-team135# | WA | 16ms | 3624kb | C++20 | 2.0kb | 2024-12-13 17:02:04 | 2024-12-13 17:02:04 |
Judging History
answer
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <bitset>
#include <fstream>
#include <array>
#include <functional>
#include <stack>
#include <memory>
using namespace std;
#define int long long
const int p=998244353;
int po(int a,int b) {if(b==0) return 1; if(b==1) return a; if(b%2==0) {int u=po(a,b/2);return (u*1LL*u)%p;} else {int u=po(a,b-1);return (a*1LL*u)%p;}}
int inv(int x) {return po(x,p-2);}
mt19937 rnd;
#define app push_back
#define all(x) (x).begin(),(x).end()
#ifdef LOCAL
#define debug(...) [](auto...a){ ((cout << a << ' '), ...) << endl;}(#__VA_ARGS__, ":", __VA_ARGS__)
#define debugv(v) do {cout<< #v <<" : {"; for(int izxc=0;izxc<v.size();++izxc) {cout << v[izxc];if(izxc+1!=v.size()) cout << ","; }cout <<"}"<< endl;} while(0)
#else
#define debug(...)
#define debugv(v)
#endif
#define lob(a,x) lower_bound(all(a),x)
#define upb(a,x) upper_bound(all(a),x)
int32_t main()
{
ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
int t;cin>>t;
while(t--)
{
int n,m;cin>>n>>m;
multiset<int> a[m];
for(int i=0;i<n;++i)
{
for(int j=0;j<m;++j)
{
int x;cin>>x;a[j].insert(x);
}
}
int cnt=0;
for(int j=0;j<m-1;++j)
{
for(int x:a[j])
{
multiset<int>::iterator it=a[j+1].lower_bound(x);
if(it!=a[j+1].begin())
{
--it;
a[j+1].erase(it);
++cnt;
}
}
}
puts(cnt>=n ? "YES" : "NO");
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3624kb
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: 3568kb
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: 16ms
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 NO 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 NO...
result:
wrong answer expected YES, found NO [2nd token]