Submission #1049341

#TimeUsernameProblemLanguageResultExecution timeMemory
1049341Marco_EscandonMars (APIO22_mars)C++17
6 / 100
8 ms2920 KiB
//#include "mars.h" #include<bits/stdc++.h> using namespace std; typedef long long ll; string merge(vector <vector<string>> a, int x, int y, int k, int n) { if(x!= 2*(n-k-1) && y!= 2*(n-k-1)) return a[0][0]; vector<vector<char>> cad(n*2+1,vector<char>(n*2+1,'0')); int pl=(k==0); for(int i=x; i<=x+1+pl; i++) { for(int j=y; j<=y+1+pl; j++) { cad[i][j]=max(cad[i][j],a[i-x][j-y][0]); } } string s; for(int i=0; i<cad.size(); i++) { for(int j=0; j<cad[0].size(); j++) { s+=cad[i][j]; } } while(s.size()<100) s+='0'; if(!pl) { for(int j=0; j<3; j++) for(int i=0; i<100; i++) { s[i]=max(s[i],a[2][j][i]); s[i]=max(s[i],a[j][2][i]); } } return s; } vector<vector<char>> cad; ll dx[]={1, 0,-1, 0}; ll dy[]={0, 1, 0,-1}; void dfs(ll i,ll j) { if(cad[i][j]=='0') return; cad[i][j]='0'; for(int k=0; k<4; k++) { dfs(dx[k]+i,dy[k]+j); } } std::string process(std::vector <std::vector<std::string>> a, int i, int j, int k, int n) { if(k==n-1) { string temp=merge(a,i,j,k,n); cad.assign(n*2+4,vector<char>(n*2+4,'0')); for(int i=0; i<(2*n+1); i++) { for(int j=0; j<(2*n+1); j++) { cad[i+1][j+1]=temp[i*(2*n+1)+j]; } } ll cont=0; for(int i=1; i<cad.size()-1; i++) { for(int j=1; j<cad[0].size()-1; j++) { if(cad[i][j]!='0') { cont++; dfs(i,j); } } } string sol=""; while(cont>0) { sol+=(cont%2+'0'); cont/=2; } while(sol.size()<100) sol+='0'; return sol; } else return merge(a,i,j,k,n); }

Compilation message (stderr)

mars.cpp: In function 'std::string merge(std::vector<std::vector<std::__cxx11::basic_string<char> > >, int, int, int, int)':
mars.cpp:18:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<char> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   18 |  for(int i=0; i<cad.size(); i++)
      |               ~^~~~~~~~~~~
mars.cpp:20:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   20 |   for(int j=0; j<cad[0].size(); j++)
      |                ~^~~~~~~~~~~~~~
mars.cpp: In function 'std::string process(std::vector<std::vector<std::__cxx11::basic_string<char> > >, int, int, int, int)':
mars.cpp:63:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<char> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   63 |   for(int i=1; i<cad.size()-1; i++)
      |                ~^~~~~~~~~~~~~
mars.cpp:65:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   65 |    for(int j=1; j<cad[0].size()-1; 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...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...