제출 #434200

#제출 시각아이디문제언어결과실행 시간메모리
434200TLP39Painting Squares (IOI20_squares)C++14
컴파일 에러
0 ms0 KiB
#include "squares.h" #include <bits/stdc++.h> using namespace std; vector<int> adj[512]; void init_adj() { for(int i=0;i<512;i++) { adj[i].clear(); adj[i].push_back((i<<1)%512); adj[i].push_back((i<<1)%512+1); } } vector<int> cyc; stack<int> path; int appear[1024]; vector<int> labels; void get_cycle() { cyc.clear(); path.push(0); int temp; while(!path.empty()) { if(adj[path.top()].size()) { temp=adj[path.top()][adj[path.top()].size()-1]; adj[path.top()].pop_back(); path.push(temp); } else { cyc.push_back(path.top()); path.pop(); } } for(int i=0;i<9;i++) labels.push(0); for(int i=0;i<1024;i++) { appear[cyc[cyc.size()-1]+(cyc[cyc.size()-2]&1)]=i; cyc.pop_back(); labels.push(cyc[cyc.size()-1]&1); } } vector<int> paint(int n) { labels.clear(); init_adj(); get_cycle(); while(labels.size()>n) labels.pop_back(); labels.push_back(10); return labels; } int find_location(int n, std::vector<int> c) { if(c[9]==-1) { for(int i=0;i<=9;i++) if(c[i]==-1) return n-i; return -1; } int code=0; for(int i=0;i<=9;i++) { code+=c[i]<<(9-i); } return appear[code]; }

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

squares.cpp: In function 'void get_cycle()':
squares.cpp:40:30: error: 'class std::vector<int>' has no member named 'push'
   40 |  for(int i=0;i<9;i++) labels.push(0);
      |                              ^~~~
squares.cpp:45:10: error: 'class std::vector<int>' has no member named 'push'
   45 |   labels.push(cyc[cyc.size()-1]&1);
      |          ^~~~
squares.cpp: In function 'std::vector<int> paint(int)':
squares.cpp:53:20: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   53 | while(labels.size()>n) labels.pop_back();
      |       ~~~~~~~~~~~~~^~