Submission #702413

#TimeUsernameProblemLanguageResultExecution timeMemory
702413chenyanSajam (COCI18_sajam)C++17
90 / 90
16 ms1236 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...