QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#875182 | #9788. Shreckless | ucup-team3646# | WA | 18ms | 3712kb | C++20 | 1.5kb | 2025-01-29 12:13:07 | 2025-01-29 12:13:07 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for(ll i = 0; i < (n); ++i)
#define rep2(i, l, r) for(ll i = (l); i < (r); ++i)
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
#define all(A) A.begin(), A.end()
#define elif else if
using pii = pair<ll, ll>;
bool chmin(auto &a, auto b) {return a > b ? a = b, 1 : 0;}
bool chmax(auto &a, auto b) {return a < b ? a = b, 1 : 0;}
struct IOS {
IOS() {
cin.tie(0);
ios::sync_with_stdio(0);
}
} iosetup;
template<class T>
void print(vector<T> a) {
for(auto x : a) cout << x << ' ';
cout << endl;
}
void print(auto x) {cout << x << endl;}
template<class Head, class... Tail>
void print(Head &&head, Tail &&...tail) {
cout << head << ' ';
print(forward<Tail>(tail)...);
}
void solve(){
int h,w;
cin>>h>>w;
vvi a(h,vi(w));
rep(i,h)rep(j,w){
cin>>a[i][j];
}
vi rem;
rep(i,h)rem.push_back(a[i][0]);
for(int j=1;j<w;j++){
sort(rem.rbegin(),rem.rend());
multiset<int>s;
rep(i,h)s.insert(a[i][j]);
int cnt=0;
for(auto x:rem){
auto itr = s.lower_bound(x);
if(itr == s.begin()){
cnt++;
}
else{
itr--;
s.erase(itr);
}
}
vi B;
for(auto x:s)B.push_back(x);
sort(B.rbegin(),B.rend());
rem.clear();
rep(idx,cnt)rem.push_back(B[idx]);
}
if(rem.size()==0)cout<<"YES\n";
else cout<<"NO\n";
}
int main(){
int T;
cin>>T;
rep(i,T)solve();
}
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 3712kb
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: 3712kb
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: 18ms
memory: 3584kb
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]