# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1078508 | mindiyak | Painting Squares (IOI20_squares) | C++14 | 68 ms | 776 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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(32);
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;
// cerr << c[0] << " " << line << " " << cnt << " " << pos << " " << (line - pos) << endl;
return line - pos;
}
int line = 32 * (32-cnt-1);
// cerr << c[0] << " " << line << " " << cnt << " " << pos << " " << (line-pos)<< endl;
return line - pos + cnt;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |