# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
776623 | 2023-07-08T06:05:25 Z | vjudge1 | Sajam (COCI18_sajam) | C++17 | 4752 ms | 5460 KB |
#include <bits/stdc++.h> using namespace std; const int N = 1e5+37; vector<int> s(N), v(N); vector<array<int, 2>> adj[N]; void f(){ freopen("in.txt", "r", stdin); freopen("out.txt", "w", stdout); } signed main(){ ios_base::sync_with_stdio(false); cin.tie(0); // f(); int n, k; cin >> n >> k; vector<string> s(n), t; vector<int> val(n), val2(n); for(auto &i: s) cin >> i; for(int i=0; i<n; i++){ for(int l=0; l<n; l++){ val[i]+=((s[i][l]=='x')?1:0); val2[l]+=((s[i][l]=='x')?1:0); } } int flag=0; for(int i=0; i<n; i++){ vector<int> tf=val; for(int l=0; l<n; l++){ if(s[i][l]=='x'){ for(int j=0; j<n; j++){ if(s[j][l]=='x'){ val[j]--; } else val[j]++; } } } int ans=0; for(int l=0; l<n; l++){ ans+=min(val[l], n-val[l]); } if(ans<=k) flag=1; val=tf; } for(int i=0; i<n; i++){ vector<int> tf=val2; for(int l=0; l<n; l++){ if(s[l][i]=='x'){ for(int j=0; j<n; j++){ if(s[l][j]=='x'){ val2[j]--; } else val2[j]++; } } } int ans=0; for(int l=0; l<n; l++){ ans+=min(val2[l], n-val2[l]); } if(ans<=k) flag=1; val2=tf; } if(flag) cout<<"DA"; else cout<<"NE"; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 3412 KB | Output is correct |
2 | Correct | 87 ms | 3796 KB | Output is correct |
3 | Correct | 151 ms | 3924 KB | Output is correct |
4 | Correct | 852 ms | 5164 KB | Output is correct |
5 | Correct | 166 ms | 4032 KB | Output is correct |
6 | Correct | 40 ms | 3676 KB | Output is correct |
7 | Correct | 550 ms | 3972 KB | Output is correct |
8 | Correct | 3941 ms | 5232 KB | Output is correct |
9 | Correct | 56 ms | 3540 KB | Output is correct |
10 | Correct | 4066 ms | 5284 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 3412 KB | Output is correct |
2 | Correct | 2 ms | 3404 KB | Output is correct |
3 | Incorrect | 4 ms | 3412 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 529 ms | 4628 KB | Output is correct |
2 | Correct | 744 ms | 4892 KB | Output is correct |
3 | Correct | 384 ms | 4408 KB | Output is correct |
4 | Correct | 306 ms | 4308 KB | Output is correct |
5 | Correct | 874 ms | 5144 KB | Output is correct |
6 | Correct | 193 ms | 4056 KB | Output is correct |
7 | Correct | 465 ms | 4584 KB | Output is correct |
8 | Correct | 535 ms | 4700 KB | Output is correct |
9 | Correct | 309 ms | 3792 KB | Output is correct |
10 | Correct | 4752 ms | 5420 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 791 ms | 5012 KB | Output is correct |
2 | Correct | 738 ms | 4980 KB | Output is correct |
3 | Correct | 318 ms | 4308 KB | Output is correct |
4 | Correct | 457 ms | 4572 KB | Output is correct |
5 | Correct | 517 ms | 4632 KB | Output is correct |
6 | Correct | 1089 ms | 5360 KB | Output is correct |
7 | Correct | 123 ms | 3924 KB | Output is correct |
8 | Correct | 433 ms | 4536 KB | Output is correct |
9 | Correct | 2102 ms | 4640 KB | Output is correct |
10 | Correct | 4734 ms | 5424 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 344 ms | 4336 KB | Output is correct |
2 | Correct | 349 ms | 4352 KB | Output is correct |
3 | Incorrect | 1236 ms | 5408 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1265 ms | 5460 KB | Output is correct |
2 | Correct | 1205 ms | 5372 KB | Output is correct |
3 | Incorrect | 1041 ms | 5252 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |