# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
575304 |
2022-06-10T07:07:34 Z |
AGE |
Sajam (COCI18_sajam) |
C++14 |
|
1516 ms |
2240 KB |
#include <bits/stdc++.h>
#define int long long
#define F first
#define S second
#define pb push_back
using namespace std;
const int N=1e6,M=3e3+2,mod=1e9+7;
string s[M];
main()
{
int n,m;
cin>>n>>m;
for(int i=0;i<n;i++)
cin>>s[i];
for(int i=0;i<n;i++){
int ans=0;
for(int j=0;j<n;j++){
if(i==j)
continue;
int cnt=0;
for(int k=0;k<n;k++)
cnt+=(s[i][k]!=s[j][k]);
int cnt2=0;
for(int k=0;k<n;k++)
cnt2+=(s[i][k]==s[j][k]);
ans+=min(cnt,cnt2);
if(ans>m)
break;
}
if(ans<=m){
cout<<"DA"<<endl;
return 0;
}
}
for(int i=0;i<n;i++){
if(s[0][i]=='x')
s[0][i]='o';
else
s[0][i]='x';
int ans=0;
for(int j=1;j<n;j++){
int cnt=0;
for(int k=0;k<n;k++)
cnt+=(s[0][k]!=s[j][k]);
int cnt2=0;
for(int k=0;k<n;k++)
cnt2+=(s[0][k]==s[j][k]);
ans+=min(cnt,cnt2);
if(ans>m)
break;
}
if(s[0][i]=='x')
s[0][i]='o';
else
s[0][i]='x';
if(ans<=m){
cout<<"DA"<<endl;
return 0;
}
}
cout<<"NE"<<endl;
}
///use scanf
///+963 998 452 343
/*
8 8
xxxxoooo
xoxoxoxo
xxxxoooo
xoxoxoxo
xxxxoooo
xoxoxoxo
xxxxoooo
xoxoxoxo
*/
Compilation message
sajam.cpp:11:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
11 | main()
| ^~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
340 KB |
Output is correct |
2 |
Correct |
6 ms |
596 KB |
Output is correct |
3 |
Correct |
7 ms |
852 KB |
Output is correct |
4 |
Correct |
18 ms |
1232 KB |
Output is correct |
5 |
Correct |
8 ms |
852 KB |
Output is correct |
6 |
Correct |
3 ms |
468 KB |
Output is correct |
7 |
Correct |
6 ms |
812 KB |
Output is correct |
8 |
Correct |
23 ms |
1160 KB |
Output is correct |
9 |
Correct |
2 ms |
340 KB |
Output is correct |
10 |
Correct |
24 ms |
1168 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
0 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
1 ms |
340 KB |
Output is correct |
5 |
Correct |
1 ms |
340 KB |
Output is correct |
6 |
Correct |
1 ms |
340 KB |
Output is correct |
7 |
Correct |
3 ms |
340 KB |
Output is correct |
8 |
Correct |
1 ms |
340 KB |
Output is correct |
9 |
Correct |
1 ms |
340 KB |
Output is correct |
10 |
Correct |
1 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
14 ms |
1032 KB |
Output is correct |
2 |
Correct |
16 ms |
1108 KB |
Output is correct |
3 |
Correct |
10 ms |
980 KB |
Output is correct |
4 |
Correct |
9 ms |
980 KB |
Output is correct |
5 |
Correct |
23 ms |
1236 KB |
Output is correct |
6 |
Correct |
254 ms |
884 KB |
Output is correct |
7 |
Correct |
495 ms |
1168 KB |
Output is correct |
8 |
Correct |
695 ms |
1112 KB |
Output is correct |
9 |
Correct |
4 ms |
596 KB |
Output is correct |
10 |
Correct |
29 ms |
2208 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
18 ms |
1172 KB |
Output is correct |
2 |
Correct |
16 ms |
1108 KB |
Output is correct |
3 |
Correct |
10 ms |
952 KB |
Output is correct |
4 |
Correct |
14 ms |
1080 KB |
Output is correct |
5 |
Correct |
15 ms |
1020 KB |
Output is correct |
6 |
Correct |
1416 ms |
2208 KB |
Output is correct |
7 |
Correct |
182 ms |
600 KB |
Output is correct |
8 |
Correct |
524 ms |
1056 KB |
Output is correct |
9 |
Correct |
15 ms |
1108 KB |
Output is correct |
10 |
Correct |
26 ms |
2184 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
11 ms |
944 KB |
Output is correct |
2 |
Correct |
12 ms |
984 KB |
Output is correct |
3 |
Correct |
960 ms |
2240 KB |
Output is correct |
4 |
Correct |
183 ms |
896 KB |
Output is correct |
5 |
Correct |
274 ms |
1064 KB |
Output is correct |
6 |
Correct |
1516 ms |
2200 KB |
Output is correct |
7 |
Correct |
245 ms |
852 KB |
Output is correct |
8 |
Correct |
276 ms |
912 KB |
Output is correct |
9 |
Correct |
11 ms |
940 KB |
Output is correct |
10 |
Correct |
11 ms |
928 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
25 ms |
2212 KB |
Output is correct |
2 |
Correct |
21 ms |
2132 KB |
Output is correct |
3 |
Correct |
836 ms |
1260 KB |
Output is correct |
4 |
Correct |
454 ms |
1060 KB |
Output is correct |
5 |
Correct |
314 ms |
1064 KB |
Output is correct |
6 |
Correct |
716 ms |
1096 KB |
Output is correct |
7 |
Correct |
264 ms |
888 KB |
Output is correct |
8 |
Correct |
1089 ms |
1216 KB |
Output is correct |
9 |
Correct |
13 ms |
980 KB |
Output is correct |
10 |
Correct |
26 ms |
1292 KB |
Output is correct |