제출 #381947

#제출 시각아이디문제언어결과실행 시간메모리
381947IwanttobreakfreePainting Squares (IOI20_squares)C++17
0 / 100
119 ms544 KiB
#include "squares.h" #include <vector> using namespace std; vector<int> guardado; vector<int> paint(int n) { vector<int> labels; guardado.clear(); vector<int> potencias(10); potencias[9]=1; for(int i=8;i>=0;i--)potencias[i]=potencias[i+1]*2; int num=1; int x=1; int cont=0; while(labels.size()!=n){ if(num>=potencias[cont]){ num-=potencias[cont]; labels.push_back(1); guardado.push_back(1); } else{ labels.push_back(0); guardado.push_back(0); } cont++; if(cont==10){ x+=2; num=x; cont=0; } } labels.push_back(30); return labels; } int find_location(int n, vector<int> c) { bool posi; for(int i=0;i<(int)guardado.size();i++){ posi=true; for(int j=0;j<n;j++){ if(c[j]==-1){ int tot=guardado.size(); return tot-n+j; } if(guardado[i+j]!=c[j]){ posi=false; break; } } if(posi)return i; } return 0; }

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

squares.cpp: In function 'std::vector<int> paint(int)':
squares.cpp:14:21: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   14 |  while(labels.size()!=n){
      |        ~~~~~~~~~~~~~^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...