제출 #1169205

#제출 시각아이디문제언어결과실행 시간메모리
1169205owieczkaPainting Squares (IOI20_squares)C++20
0 / 100
27 ms408 KiB
#include "squares.h" #include <vector> std::vector<int> paint(int n) { std::vector<int> labels(n + 1, 0); int prz = 15; // jeden prz takiej dl int a = 7; labels[n] = 30; for (int i = 0; i < n; i++) { int j = i % prz; int id = i / prz; if (j < a)labels[i] = 1; else if (j == a || j == 2*a)labels[i] = 0; else { if (id & (1 << (j - a-1))) { labels[i] = 1; } else { labels[i] = 0; } } } return labels; } int find_location(int n, std::vector<int> c) { int a = 7; int prz = 15; for (int i = 0; i < c.size(); i++) { if (c[i] == -1) { return n - i; } } int con1 = 0; int fn = 0; for (; fn < c.size(); fn++) { if (c[fn] == 1)con1++; else con1=0; if (con1 == a)//i+1 == 0 a dalej mamy liczbe { break; } } fn += 2;//poczatek numeru przedziału // if () int x = 0; for (int i = 0; i < a-1; i++) { if (c[fn + i]) { x += 1 << i; } } //jestem w xtym przedziale fn -= 8; return x * prz - fn; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...