# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
702413 |
2023-02-24T02:29:23 Z |
chenyan |
Sajam (COCI18_sajam) |
C++17 |
|
16 ms |
1236 KB |
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define pii pair<int,int>
#define ff first
#define ss second
#define all(x) x.begin(),x.end()
#define pb emplace_back
#define N 200010
int cnt[N];
signed main(){
ios::sync_with_stdio(0);
cin.tie(0);
int n,i,k,j;
cin>>n>>k;
string s;
for(j=0;j<n;j++){
cin>>s;
int r1=0,r2=0,r=0;
for(i=0;i<n;i++){
int x=(s[i]=='o'?1:0);
r1+=min(j-cnt[i]-x,cnt[i]+x);
r2+=min(j-cnt[i]-(x^1),cnt[i]+(x^1));
}
if(r1>r2)r=1;
for(i=0;i<n;i++){
int x=(s[i]=='o'?1:0)^r;
cnt[i]+=x;
}
}
int ans=0;
for(i=0;i<n;i++)ans+=min(n-cnt[i],cnt[i]);
cout<<(ans<=k?"DA":"NE")<<'\n';
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
2 ms |
468 KB |
Output is correct |
3 |
Correct |
2 ms |
596 KB |
Output is correct |
4 |
Correct |
16 ms |
1080 KB |
Output is correct |
5 |
Correct |
2 ms |
572 KB |
Output is correct |
6 |
Correct |
1 ms |
428 KB |
Output is correct |
7 |
Correct |
3 ms |
468 KB |
Output is correct |
8 |
Correct |
4 ms |
1108 KB |
Output is correct |
9 |
Correct |
1 ms |
340 KB |
Output is correct |
10 |
Correct |
5 ms |
1088 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
328 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
328 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
0 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
0 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
852 KB |
Output is correct |
2 |
Correct |
5 ms |
952 KB |
Output is correct |
3 |
Correct |
3 ms |
724 KB |
Output is correct |
4 |
Correct |
2 ms |
720 KB |
Output is correct |
5 |
Correct |
4 ms |
1108 KB |
Output is correct |
6 |
Correct |
2 ms |
596 KB |
Output is correct |
7 |
Correct |
3 ms |
852 KB |
Output is correct |
8 |
Correct |
3 ms |
852 KB |
Output is correct |
9 |
Correct |
2 ms |
468 KB |
Output is correct |
10 |
Correct |
5 ms |
1216 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
980 KB |
Output is correct |
2 |
Correct |
5 ms |
976 KB |
Output is correct |
3 |
Correct |
2 ms |
700 KB |
Output is correct |
4 |
Correct |
3 ms |
864 KB |
Output is correct |
5 |
Correct |
3 ms |
852 KB |
Output is correct |
6 |
Correct |
5 ms |
1212 KB |
Output is correct |
7 |
Correct |
3 ms |
448 KB |
Output is correct |
8 |
Correct |
3 ms |
824 KB |
Output is correct |
9 |
Correct |
5 ms |
852 KB |
Output is correct |
10 |
Correct |
6 ms |
1220 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
744 KB |
Output is correct |
2 |
Correct |
3 ms |
724 KB |
Output is correct |
3 |
Correct |
6 ms |
1220 KB |
Output is correct |
4 |
Correct |
2 ms |
596 KB |
Output is correct |
5 |
Correct |
3 ms |
704 KB |
Output is correct |
6 |
Correct |
5 ms |
1212 KB |
Output is correct |
7 |
Correct |
2 ms |
596 KB |
Output is correct |
8 |
Correct |
3 ms |
596 KB |
Output is correct |
9 |
Correct |
3 ms |
596 KB |
Output is correct |
10 |
Correct |
2 ms |
588 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
1236 KB |
Output is correct |
2 |
Correct |
6 ms |
1216 KB |
Output is correct |
3 |
Correct |
5 ms |
1088 KB |
Output is correct |
4 |
Correct |
3 ms |
724 KB |
Output is correct |
5 |
Correct |
3 ms |
852 KB |
Output is correct |
6 |
Correct |
4 ms |
824 KB |
Output is correct |
7 |
Correct |
2 ms |
596 KB |
Output is correct |
8 |
Correct |
4 ms |
1088 KB |
Output is correct |
9 |
Correct |
3 ms |
736 KB |
Output is correct |
10 |
Correct |
6 ms |
1108 KB |
Output is correct |