Submission #562276

#TimeUsernameProblemLanguageResultExecution timeMemory
562276AGESajam (COCI18_sajam)C++14
15 / 90
41 ms34420 KiB
#include<bits/stdc++.h> #define F first #define S second #define pb push_back #define int long long using namespace std; const int N=1e6,M=2e3,mod=1e9+7; string s[N]; int dp[M][M][2][2],col[M],row[M],p[N]; int root(int x){ if(p[x]==x) return p[x]=x; return p[x]=root(p[x]); } void onion(int x,int y){ x=root(x); y=root(y); if(x==y) return ; p[y]=x; } main() { int n,m; cin>>n>>m; for(int i=0;i<n;i++) cin>>s[i]; /* for(int i=0;i<n;i++) for(int j=0;j<s[i].size();j++) if(s[i][j]=='x') col[j][0]=1; else col[j][1]=1; */ for(int j=0;j<n;j++) p[j]=j; int z=n,o=n; for(int i=0;i<n;i++){ for(int j=0;j<s[i].size();j++){ if(s[i][j]=='x') z=min(j,z),onion(z,j); else o=min(o,j),onion(o,j); } if(i==0) break; } int ok=0; for(int i=0;i<n;i++){ for(int j=0;j<n;j++){ if(s[i][j]!=s[i][root(j)]) ok=1; } } if(ok==1) cout<<"NE"<<endl; else cout<<"DA"<<endl; return 0; }

Compilation message (stderr)

sajam.cpp:29:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   29 | main()
      | ^~~~
sajam.cpp: In function 'int main()':
sajam.cpp:53:22: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   53 |         for(int j=0;j<s[i].size();j++){
      |                     ~^~~~~~~~~~~~
#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...