Submission #575303

#TimeUsernameProblemLanguageResultExecution timeMemory
575303AGESajam (COCI18_sajam)C++14
90 / 90
2871 ms3212 KiB
#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 (stderr)

sajam.cpp:11:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   11 | main()
      | ^~~~
#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...