제출 #465786

#제출 시각아이디문제언어결과실행 시간메모리
465786MohamedFaresNebiliHandcrafted Gift (IOI20_gift)C++14
0 / 100
1597 ms12444 KiB
#include "gift.h" #include <bits/stdc++.h> using namespace std; int construct(int n, int r, std::vector<int> a, std::vector<int> b, std::vector<int> x) { bool used=true; string s(n, 'X'); for(int l=0;l<r&&used;l++) { int lo=a[l], hi=b[l], w=x[l]; if(w==1) { char col='X'; for(int i=lo;i<=hi;i++) if(s[i]!='X') col=s[i]; if(col=='X') col='R'; for(int i=lo;i<=hi;i++) { if(s[i]!='X'&&s[i]!=col) used=false; else s[i]=col; } } else if(w==2) { int red=0, blue=0; for(int i=lo;i<=hi;i++) { if(s[i]=='R') red++; else if(s[i]=='B') blue++; } if(red&&blue) continue; char col; bool found=true; if(blue==0) col='B'; else col='R'; bool yes=false; for(int i=lo;i<=hi&&found;i++) { if(s[i]=='X') { s[i]=col; found=false; yes=true; } } if(!yes) used=false; } } for(int l=0;l<n;l++) if(s[l]=='X') s[l]='R'; if(used) { craft(s); return 1; } return 0; }

컴파일 시 표준 에러 (stderr) 메시지

gift.cpp: In function 'int construct(int, int, std::vector<int>, std::vector<int>, std::vector<int>)':
gift.cpp:27:4: warning: this 'else' clause does not guard... [-Wmisleading-indentation]
   27 |    else col='R'; bool yes=false;
      |    ^~~~
gift.cpp:27:18: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'else'
   27 |    else col='R'; bool yes=false;
      |                  ^~~~
#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...