제출 #1078495

#제출 시각아이디문제언어결과실행 시간메모리
1078495mindiyakPainting Squares (IOI20_squares)C++14
0 / 100
77 ms768 KiB
#include "squares.h" #include <vector> #include <iostream> using namespace std; vector<int> paint(int n) { vector<int> labels; int cnt = 1; for(int i=0;i<1000;i++){ for(int j = 0;j<(32-cnt);j++)cerr << 0; for(int j = 0;j<cnt;j++)cerr << 1; cerr << endl; cnt ++; i += 31; } cnt = 1; for(int i=0;i<n;i++){ for(int j = 0;j<(32-cnt);j++)labels.push_back(0); for(int j = 0;j<cnt;j++)labels.push_back(1); cnt ++; i += 31; } labels.resize(n); labels.push_back(69); return labels; } int find_location(int n, vector<int> c) { for (int i = 0; i < c.size(); i++) if (c[i] == -1) return n-i; int cnt = 0,pos = 0; for (int i = 1; i < c.size(); i++){ if(c[i] != c[0])cnt ++; else{ if(cnt != 0){ pos = i; break; } } } if(c[0] == 0){ int line = cnt * 32; return line - pos+1; } int line = 32 * (32-cnt); return line - pos+1; }

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

squares.cpp: In function 'int find_location(int, std::vector<int>)':
squares.cpp:30:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   30 |  for (int i = 0; i < c.size(); i++) if (c[i] == -1) return n-i;
      |                  ~~^~~~~~~~~~
squares.cpp:33:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   33 |  for (int i = 1; i < c.size(); i++){
      |                  ~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...