제출 #386327

#제출 시각아이디문제언어결과실행 시간메모리
386327leinad2벽 칠하기 (APIO20_paint)C++17
28 / 100
1597 ms3180 KiB
#include<bits/stdc++.h> using namespace std; vector<vector<int> >B; bool chk(int a, int b) { int s=0, e=B[a].size(); while(s<e) { int m=s+e>>1; if(B[a][m]>=b)e=m; if(B[a][m]<b)s=m+1; } return B[a][s]==b; } int minimumInstructions(int N, int M, int K, vector<int>C, vector<int>A, vector<vector<int> >bB) { B=bB; int i, j, k; vector<int>X;X.resize(N); for(i=0;i<M;i++) { for(j=0;j<=N-M;j++) { int a=0; for(k=0;k<M;k++) { a+=chk((i+k>=M?i+k-M:i+k), C[j+k]); } if(a==M)X[j]=1; } } i=0; if(X[0]==0||X[N-M]==0)return -1; int ans=0; while(1) { if(i==N-M)return ans+1; k=-1; for(j=i+1;j<=i+M;j++) { if(X[j])k=j; } if(k==-1)return -1; i=k;ans++; } }

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

paint.cpp: In function 'bool chk(int, int)':
paint.cpp:9:16: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
    9 |         int m=s+e>>1;
      |               ~^~
#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...