제출 #741364

#제출 시각아이디문제언어결과실행 시간메모리
741364josanneo22Painting Squares (IOI20_squares)C++17
100 / 100
870 ms588 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(int n){ vector<int> ans; int k = 10; for (int i = 0; i < 10 && ans.size()<n; i++) ans.push_back(1); int v = (1 << k) - 1; vector<bool> kt(1 << k); kt[v] = true; while ((int)ans.size() < n) { v = (v << 1) % (1 << k); int sign = 0; if (kt[v]) { v++; sign = 1; } kt[v] = true; ans.push_back(sign); } return ans; } vector<int> paint(int n) { vector<int> labels=Init(n); labels.pb(10); return labels; } int find_location(int n, vector<int> c) { vector<int> ans=Init(n); for(int i=0;i<n;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> Init(int)':
squares.cpp:17:38: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   17 |  for (int i = 0; i < 10 && ans.size()<n; i++) ans.push_back(1);
      |                            ~~~~~~~~~~^~
squares.cpp: In function 'int find_location(int, std::vector<int>)':
squares.cpp:41:24: warning: control reaches end of non-void function [-Wreturn-type]
   41 |  vector<int> ans=Init(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...