제출 #429815

#제출 시각아이디문제언어결과실행 시간메모리
429815tinjyuPainting Squares (IOI20_squares)C++14
0 / 100
30 ms768 KiB
#include "squares.h" #include <vector> #include <iostream> using namespace std; long long int tag[10005],now[100005]; int check(int s) { for(int i=0;i<=s-10;i++) { long long int c=0,p=s; for(int j=i;j<i+10;j++) { if(now[j]!=now[p])c=1; p++; } if(c==0)return 1; } return 0; } std::vector<int> paint(int n) { std::vector<int> labels(n + 1); labels[n]=10; if(n<10) { labels[n]=n; return labels; } for(int i=0;i<min(10,n);i++) { labels[i]=0; now[i]=0; } tag[0]=1; for(int i=10;i<n;i++) { labels[i]=0; now[i]=0; if(check(i-10+1)==1) { labels[i]=1; now[i]=1; } //cout<<now[i]; } return labels; } int find_location(int n, std::vector<int> c) { for(int i=0;i<c.size();i++)cout<<c[i]<<" "; cout<<endl; if(c[c.size()-1]==-1) { long long int ans=n; for(int i=0;;i++) { if(c[i]==-1)break; ans--; } return ans-1; } for(int i=0;i<10;i++) { now[i]=0; } for(int i=10;i<n;i++) { now[i]=0; if(check(i-9)==1) { now[i]=1; } } for(int i=0;i<n;i++) { long long int p=0,can=0; for(int j=i;j<i+10;j++) { if(now[j]!=c[p])can=1; p++; } if(can==0)return i; } }

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

squares.cpp: In function 'int find_location(int, std::vector<int>)':
squares.cpp:50:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   50 |  for(int i=0;i<c.size();i++)cout<<c[i]<<" ";
      |              ~^~~~~~~~~
squares.cpp:85:1: warning: control reaches end of non-void function [-Wreturn-type]
   85 | }
      | ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...