제출 #741355

#제출 시각아이디문제언어결과실행 시간메모리
741355josanneo22Painting Squares (IOI20_squares)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; #define mp make_pair #define pb push_back #define pii pair<int,int> #define fi first #define se second #include "squares.h" #include <vector> vector<int> Init(){ vector<int>ans; int k = 10; for (int i = 0; i < 10; i++) ans.push_back(1); int v = (1 << k) - 1; vector<bool> kt(1 << k); kt[v] = true; while ((int)ans.size() < 1000) { v = (v << 1) % (1 << k); int sign = 0; if (kt[v]) { v++; sign = 1; } kt[v] = true; ans.push_back(sign); } return ans; } std::vector<int> paint(int n) { vector<int> labels=Init(); lables.pb(10); return lables; } int find_location(int n, std::vector<int> c) { vector<int> ans=Init(); for(int i=0;i<ans.size();i++){ vector<int> nw; for(int j=0;j<10;j++){ if(i+j>=n) nw.pb(-1); else nw.pb(ans[i+j]); } if(nw==c) return i; } }

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

squares.cpp: In function 'std::vector<int> paint(int)':
squares.cpp:36:2: error: 'lables' was not declared in this scope; did you mean 'labels'?
   36 |  lables.pb(10);
      |  ^~~~~~
      |  labels
squares.cpp: In function 'int find_location(int, std::vector<int>)':
squares.cpp:42:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   42 |  for(int i=0;i<ans.size();i++){
      |              ~^~~~~~~~~~~
squares.cpp:41:23: warning: control reaches end of non-void function [-Wreturn-type]
   41 |  vector<int> ans=Init();
      |                       ^