# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
776680 | 2023-07-08T07:00:57 Z | vjudge1 | Sajam (COCI18_sajam) | C++17 | 5000 ms | 2304 KB |
#include <bits/stdc++.h> using namespace std; const int N = 1e5+37; 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; } k--; for(int i=0; i<n; i++){ vector<int> tf=val; if(s[0][i]=='x') val[0]--; else val[0]++; s[0][i]=(s[0][i]=='x'?'o':'x'); for(int l=0; l<n; l++){ if(s[0][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; if(s[0][i]=='x') val[0]--; else val[0]++; s[0][i]=(s[0][i]=='x'?'o':'x'); } if(flag) cout<<"DA"; else cout<<"NE"; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 96 ms | 500 KB | Output is correct |
3 | Correct | 173 ms | 596 KB | Output is correct |
4 | Correct | 977 ms | 1212 KB | Output is correct |
5 | Correct | 178 ms | 612 KB | Output is correct |
6 | Correct | 42 ms | 340 KB | Output is correct |
7 | Correct | 571 ms | 596 KB | Output is correct |
8 | Correct | 4427 ms | 1252 KB | Output is correct |
9 | Correct | 59 ms | 364 KB | Output is correct |
10 | Correct | 4488 ms | 1276 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Incorrect | 1 ms | 212 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 551 ms | 928 KB | Output is correct |
2 | Correct | 741 ms | 1064 KB | Output is correct |
3 | Correct | 408 ms | 816 KB | Output is correct |
4 | Correct | 328 ms | 748 KB | Output is correct |
5 | Correct | 1030 ms | 1192 KB | Output is correct |
6 | Correct | 198 ms | 596 KB | Output is correct |
7 | Correct | 518 ms | 1444 KB | Output is correct |
8 | Correct | 597 ms | 1552 KB | Output is correct |
9 | Correct | 364 ms | 604 KB | Output is correct |
10 | Execution timed out | 5050 ms | 2304 KB | Time limit exceeded |
11 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 879 ms | 1108 KB | Output is correct |
2 | Correct | 850 ms | 1120 KB | Output is correct |
3 | Correct | 358 ms | 768 KB | Output is correct |
4 | Correct | 504 ms | 896 KB | Output is correct |
5 | Correct | 578 ms | 852 KB | Output is correct |
6 | Correct | 1221 ms | 1236 KB | Output is correct |
7 | Correct | 128 ms | 776 KB | Output is correct |
8 | Correct | 464 ms | 1340 KB | Output is correct |
9 | Correct | 2361 ms | 1492 KB | Output is correct |
10 | Execution timed out | 5040 ms | 2260 KB | Time limit exceeded |
11 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 391 ms | 768 KB | Output is correct |
2 | Correct | 382 ms | 780 KB | Output is correct |
3 | Incorrect | 1428 ms | 1364 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1443 ms | 1392 KB | Output is correct |
2 | Correct | 1382 ms | 1328 KB | Output is correct |
3 | Incorrect | 1169 ms | 1252 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |