# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
575303 |
2022-06-10T07:06:02 Z |
AGE |
Sajam (COCI18_sajam) |
C++14 |
|
2871 ms |
3212 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){
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(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 |
692 KB |
Output is correct |
3 |
Correct |
7 ms |
1048 KB |
Output is correct |
4 |
Correct |
20 ms |
1940 KB |
Output is correct |
5 |
Correct |
7 ms |
1092 KB |
Output is correct |
6 |
Correct |
4 ms |
536 KB |
Output is correct |
7 |
Correct |
357 ms |
1088 KB |
Output is correct |
8 |
Correct |
2333 ms |
2100 KB |
Output is correct |
9 |
Correct |
37 ms |
468 KB |
Output is correct |
10 |
Correct |
2360 ms |
2128 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
2 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 |
400 KB |
Output is correct |
8 |
Correct |
1 ms |
404 KB |
Output is correct |
9 |
Correct |
2 ms |
340 KB |
Output is correct |
10 |
Correct |
3 ms |
404 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
16 ms |
1596 KB |
Output is correct |
2 |
Correct |
19 ms |
1776 KB |
Output is correct |
3 |
Correct |
11 ms |
1428 KB |
Output is correct |
4 |
Correct |
10 ms |
1312 KB |
Output is correct |
5 |
Correct |
18 ms |
1940 KB |
Output is correct |
6 |
Correct |
507 ms |
1176 KB |
Output is correct |
7 |
Correct |
1171 ms |
1628 KB |
Output is correct |
8 |
Correct |
1385 ms |
1700 KB |
Output is correct |
9 |
Correct |
194 ms |
724 KB |
Output is correct |
10 |
Correct |
2809 ms |
3208 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
18 ms |
1944 KB |
Output is correct |
2 |
Correct |
17 ms |
1876 KB |
Output is correct |
3 |
Correct |
11 ms |
1320 KB |
Output is correct |
4 |
Correct |
12 ms |
1620 KB |
Output is correct |
5 |
Correct |
14 ms |
1672 KB |
Output is correct |
6 |
Correct |
2642 ms |
3128 KB |
Output is correct |
7 |
Correct |
346 ms |
820 KB |
Output is correct |
8 |
Correct |
1080 ms |
1576 KB |
Output is correct |
9 |
Correct |
1253 ms |
1648 KB |
Output is correct |
10 |
Correct |
2871 ms |
3212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
10 ms |
1344 KB |
Output is correct |
2 |
Correct |
11 ms |
1416 KB |
Output is correct |
3 |
Correct |
2131 ms |
3188 KB |
Output is correct |
4 |
Correct |
413 ms |
1220 KB |
Output is correct |
5 |
Correct |
526 ms |
1432 KB |
Output is correct |
6 |
Correct |
2708 ms |
3112 KB |
Output is correct |
7 |
Correct |
433 ms |
1172 KB |
Output is correct |
8 |
Correct |
547 ms |
1236 KB |
Output is correct |
9 |
Correct |
548 ms |
1244 KB |
Output is correct |
10 |
Correct |
522 ms |
1236 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
27 ms |
3188 KB |
Output is correct |
2 |
Correct |
26 ms |
3108 KB |
Output is correct |
3 |
Correct |
1831 ms |
2112 KB |
Output is correct |
4 |
Correct |
1103 ms |
1612 KB |
Output is correct |
5 |
Correct |
620 ms |
1604 KB |
Output is correct |
6 |
Correct |
1267 ms |
1744 KB |
Output is correct |
7 |
Correct |
458 ms |
1184 KB |
Output is correct |
8 |
Correct |
1959 ms |
1968 KB |
Output is correct |
9 |
Correct |
790 ms |
1364 KB |
Output is correct |
10 |
Correct |
2570 ms |
2192 KB |
Output is correct |