제출 #1318914

#제출 시각아이디문제언어결과실행 시간메모리
1318914ezzzayPainting Squares (IOI20_squares)C++20
0 / 100
4 ms464 KiB
#include "squares.h" #include <vector> #include<bits/stdc++.h> using namespace std; std::vector<int> paint(int n) { std::vector<int> labels(n + 1); int p=1; for(int i=0;i<n;i+=p){ labels[i]=1; p++; } labels[n]=70; return labels; } int find_location(int n, std::vector<int> c) { int cnt=0; for(int i=0;i<n;i++){ if(c[i]==-1)cnt++; } if(cnt){ return n-(70-cnt)+2; } int p=0; int l=0; int L=0; int R=0; for(auto a:c)cout<<a<<" "; cout<<endl; while(!c.empty()){ if(c.back()==1){ if(p==0){ L=l; } if(p==1){ R=l; } p++; l=0; } else{ l++; } c.pop_back(); } cout<<R<<" "<<L<<endl; int h= (R+1)*(R+2)/2; h+=L-70; return h; // 1 2 3 4 5 // 1 3 6 10 15 21 // 1 0 1 0 0 1 // 1 . . . . . 0000 1 }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...