Submission #1019277

#TimeUsernameProblemLanguageResultExecution timeMemory
1019277AikaThe Kingdom of JOIOI (JOI17_joioi)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #define int long long #define Aiko ios::sync_with_stdio(0), cin.tie(0), cout.tie(0); #define pb push_back using namespace std; const int INF=1e9; signed main(){ int h, w, i, j; cin>>h>>w; int a[h][w], mx=0,mn=INF; for(i=0;i<h;i++){ for(j=0;j<w;j++){ cin>>a[i][j]; mn=min(mn,a[i][j]); mx=max(mx,a[i][j]); } } int color[h][w]; auto fun=[&](int t){ for(i=0;i<h;i++){ for(j=0;j<w;j++){ if(abs(a[i][j]-mn)<=t)color[i][j]=1; } } for(i=0;i<h;i++){ for(j=0;j<w;j++){ if(color[i][j]!=1&&abs(a[i][j]-mx)<=t)color[i][j]=2; else if(abs(a[i][j]-mx)<=t)color[i][j]=3; } } int ans[h],ans1[h],ans2[w],ans3[w]; for(i=0;i<h;i++){ bool a2=0; for(j=0;j<w;j++){ if(color[i][j]==1)ans[i]=j; if(color[i][j]==2&&a2==0){ a2=1; ans1[i]=j; } } } for(i=0;i<h;i++){ bool a2=0; for(j=0;j<h;j++){ if(color[i][j]==1)ans[i]=j; if(color[i][j]==2&&a2==0){ a2=1; ans1[i]=j; } } } for(i=0;i<w;i++){ bool a2=0; for(j=0;j<h;j++){ if(color[i][j]==1)ans2[i]=j; if(color[i][j]==2&&a2==0){ a2=1; ans3[i]=j; } } } bool a1=0; for(i=0;i<h;i++){ if(ans[i]>ans1[i])a1=1; } for(i=0;i<w;i++){ if(ans2[i]>ans3[i])a1=1; } if(a1==1)return false; else return true; }; int l=0,r=1e9+7; while(r>l+1){ int m=(l+r)>>1; if(fun(m))r=m; else l=m; } if(fun(r))cout<<r; else cout<<l; }

Compilation message (stderr)

joioi.cpp: In lambda function:
joioi.cpp:22:12: sorry, unimplemented: capture of variably-modified type 'long long int [h][w]' that is not an N3639 array of runtime bound
   22 |     if(abs(a[i][j]-mn)<=t)color[i][j]=1;
      |            ^
joioi.cpp:22:12: note: because the array element type 'long long int [w]' has variable size
joioi.cpp:22:27: sorry, unimplemented: capture of variably-modified type 'long long int [h][w]' that is not an N3639 array of runtime bound
   22 |     if(abs(a[i][j]-mn)<=t)color[i][j]=1;
      |                           ^~~~~
joioi.cpp:22:27: note: because the array element type 'long long int [w]' has variable size
joioi.cpp:27:8: sorry, unimplemented: capture of variably-modified type 'long long int [h][w]' that is not an N3639 array of runtime bound
   27 |     if(color[i][j]!=1&&abs(a[i][j]-mx)<=t)color[i][j]=2;
      |        ^~~~~
joioi.cpp:27:8: note: because the array element type 'long long int [w]' has variable size
joioi.cpp:27:28: sorry, unimplemented: capture of variably-modified type 'long long int [h][w]' that is not an N3639 array of runtime bound
   27 |     if(color[i][j]!=1&&abs(a[i][j]-mx)<=t)color[i][j]=2;
      |                            ^
joioi.cpp:27:28: note: because the array element type 'long long int [w]' has variable size
joioi.cpp:27:43: sorry, unimplemented: capture of variably-modified type 'long long int [h][w]' that is not an N3639 array of runtime bound
   27 |     if(color[i][j]!=1&&abs(a[i][j]-mx)<=t)color[i][j]=2;
      |                                           ^~~~~
joioi.cpp:27:43: note: because the array element type 'long long int [w]' has variable size
joioi.cpp:28:17: sorry, unimplemented: capture of variably-modified type 'long long int [h][w]' that is not an N3639 array of runtime bound
   28 |     else if(abs(a[i][j]-mx)<=t)color[i][j]=3;
      |                 ^
joioi.cpp:28:17: note: because the array element type 'long long int [w]' has variable size
joioi.cpp:28:32: sorry, unimplemented: capture of variably-modified type 'long long int [h][w]' that is not an N3639 array of runtime bound
   28 |     else if(abs(a[i][j]-mx)<=t)color[i][j]=3;
      |                                ^~~~~
joioi.cpp:28:32: note: because the array element type 'long long int [w]' has variable size
joioi.cpp:35:8: sorry, unimplemented: capture of variably-modified type 'long long int [h][w]' that is not an N3639 array of runtime bound
   35 |     if(color[i][j]==1)ans[i]=j;
      |        ^~~~~
joioi.cpp:35:8: note: because the array element type 'long long int [w]' has variable size
joioi.cpp:36:8: sorry, unimplemented: capture of variably-modified type 'long long int [h][w]' that is not an N3639 array of runtime bound
   36 |     if(color[i][j]==2&&a2==0){
      |        ^~~~~
joioi.cpp:36:8: note: because the array element type 'long long int [w]' has variable size
joioi.cpp:45:8: sorry, unimplemented: capture of variably-modified type 'long long int [h][w]' that is not an N3639 array of runtime bound
   45 |     if(color[i][j]==1)ans[i]=j;
      |        ^~~~~
joioi.cpp:45:8: note: because the array element type 'long long int [w]' has variable size
joioi.cpp:46:8: sorry, unimplemented: capture of variably-modified type 'long long int [h][w]' that is not an N3639 array of runtime bound
   46 |     if(color[i][j]==2&&a2==0){
      |        ^~~~~
joioi.cpp:46:8: note: because the array element type 'long long int [w]' has variable size
joioi.cpp:55:8: sorry, unimplemented: capture of variably-modified type 'long long int [h][w]' that is not an N3639 array of runtime bound
   55 |     if(color[i][j]==1)ans2[i]=j;
      |        ^~~~~
joioi.cpp:55:8: note: because the array element type 'long long int [w]' has variable size
joioi.cpp:56:8: sorry, unimplemented: capture of variably-modified type 'long long int [h][w]' that is not an N3639 array of runtime bound
   56 |     if(color[i][j]==2&&a2==0){
      |        ^~~~~
joioi.cpp:56:8: note: because the array element type 'long long int [w]' has variable size
joioi.cpp: In function 'int main()':
joioi.cpp:18:6: warning: variable 'color' set but not used [-Wunused-but-set-variable]
   18 |  int color[h][w];
      |      ^~~~~