Task: | Modern art |
Sender: | Rasse |
Submission time: | 2024-11-11 17:15:23 +0200 |
Language: | C++ (C++17) |
Status: | READY |
Result: | ACCEPTED |
test | verdict | time | |
---|---|---|---|
#1 | ACCEPTED | 0.00 s | details |
#2 | ACCEPTED | 0.00 s | details |
#3 | ACCEPTED | 0.00 s | details |
#4 | ACCEPTED | 0.00 s | details |
#5 | ACCEPTED | 0.00 s | details |
#6 | ACCEPTED | 0.00 s | details |
#7 | ACCEPTED | 0.00 s | details |
#8 | ACCEPTED | 0.00 s | details |
#9 | ACCEPTED | 0.00 s | details |
#10 | ACCEPTED | 0.00 s | details |
#11 | ACCEPTED | 0.00 s | details |
#12 | ACCEPTED | 0.00 s | details |
#13 | ACCEPTED | 0.00 s | details |
#14 | ACCEPTED | 0.00 s | details |
#15 | ACCEPTED | 0.00 s | details |
#16 | ACCEPTED | 0.00 s | details |
#17 | ACCEPTED | 0.00 s | details |
#18 | ACCEPTED | 0.00 s | details |
#19 | ACCEPTED | 0.00 s | details |
#20 | ACCEPTED | 0.00 s | details |
#21 | ACCEPTED | 0.00 s | details |
#22 | ACCEPTED | 0.00 s | details |
#23 | ACCEPTED | 0.00 s | details |
#24 | ACCEPTED | 0.00 s | details |
#25 | ACCEPTED | 0.00 s | details |
#26 | ACCEPTED | 0.00 s | details |
#27 | ACCEPTED | 0.00 s | details |
#28 | ACCEPTED | 0.00 s | details |
#29 | ACCEPTED | 0.00 s | details |
#30 | ACCEPTED | 0.00 s | details |
#31 | ACCEPTED | 0.00 s | details |
#32 | ACCEPTED | 0.00 s | details |
#33 | ACCEPTED | 0.00 s | details |
#34 | ACCEPTED | 0.00 s | details |
#35 | ACCEPTED | 0.00 s | details |
#36 | ACCEPTED | 0.00 s | details |
#37 | ACCEPTED | 0.00 s | details |
#38 | ACCEPTED | 0.00 s | details |
#39 | ACCEPTED | 0.00 s | details |
#40 | ACCEPTED | 0.00 s | details |
#41 | ACCEPTED | 0.00 s | details |
#42 | ACCEPTED | 0.01 s | details |
#43 | ACCEPTED | 0.00 s | details |
#44 | ACCEPTED | 0.00 s | details |
#45 | ACCEPTED | 0.00 s | details |
#46 | ACCEPTED | 0.00 s | details |
#47 | ACCEPTED | 0.00 s | details |
#48 | ACCEPTED | 0.00 s | details |
#49 | ACCEPTED | 0.00 s | details |
#50 | ACCEPTED | 0.00 s | details |
Compiler report
input/code.cpp: In function 'void solve()': input/code.cpp:88:23: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::__cxx11::basic_string<char> >::size_type' {aka 'long unsigned int'} [-Wsign-compare] 88 | for (int i = 0; i < output.size(); i++) | ~~^~~~~~~~~~~~~~~
Code
#include <iostream> #include <vector> #include <array> #include <string> #include <algorithm> #include <numeric> #include <unordered_map> #include <unordered_set> #include <queue> #include <climits> #include <cmath> #include <functional> #include <type_traits> #include <fstream> #include <bitset> #include <complex> #include <iomanip> #define int long long using namespace std; //#define cross(x, y) ((x).real()*(y).imag()-(x).imag()*(y).real()) #define cross(x, y) (((x)*conj(y)).imag()) #define sign(v) ((0 < (v)) - ((v) < 0)) void solve() { int a, p; cin >> a >> p; if (p % 2 == 1) { cout << "IMPOSSIBLE"; return; } int inputtedBlockCount = 0; vector<string> output; int needed = p / 2 - 1; int hor = (needed+1) / 2; int ver = needed - hor; // Start from 1 int stillNeeded = a - needed; int width = hor + 2; output.push_back(string(width, '0')); // First line output.push_back(string()); output[1].push_back('0'); for (int i = 0; i < hor; i++) { output[1].push_back('1'); inputtedBlockCount++; } output[1].push_back('0'); for (int i = 2; i <= ver+1; i++) { output.push_back(string()); output[i].push_back('0'); output[i].push_back('1'); inputtedBlockCount++; int c = 0; for (; stillNeeded > 0 && c < hor-1; c++) { output[i].push_back('1'); inputtedBlockCount++; stillNeeded--; } for (; c < hor-1; c++) output[i].push_back('0'); output[i].push_back('0'); } output.push_back(string(width, '0')); if (inputtedBlockCount != a) { cout << "IMPOSSIBLE"; return; } cout << "POSSIBLE" << '\n'; for (int i = 0; i < output.size(); i++) { cout << output[i] << '\n'; } } signed main() { ios::sync_with_stdio(0); cout.precision(25); //setprecision(10); //cin.tie(0); int t = 1; //cin >> t; //ifstream f("testcase.txt"); //cin.rdbuf(f.rdbuf()); for (int i = 0; i < t; i++) solve(); }
Test details
Test 1
Verdict: ACCEPTED
input |
---|
5 14 |
correct output |
---|
IMPOSSIBLE |
user output |
---|
IMPOSSIBLE |
Test 2
Verdict: ACCEPTED
input |
---|
6 14 |
correct output |
---|
POSSIBLE 000 010 010 010 ... |
user output |
---|
POSSIBLE 00000 01110 01000 01000 ... |
Test 3
Verdict: ACCEPTED
input |
---|
7 10 |
correct output |
---|
IMPOSSIBLE |
user output |
---|
IMPOSSIBLE |
Test 4
Verdict: ACCEPTED
input |
---|
5 5 |
correct output |
---|
IMPOSSIBLE |
user output |
---|
IMPOSSIBLE |
Test 5
Verdict: ACCEPTED
input |
---|
6 22 |
correct output |
---|
IMPOSSIBLE |
user output |
---|
IMPOSSIBLE |
Test 6
Verdict: ACCEPTED
input |
---|
7 10 |
correct output |
---|
IMPOSSIBLE |
user output |
---|
IMPOSSIBLE |
Test 7
Verdict: ACCEPTED
input |
---|
5 20 |
correct output |
---|
IMPOSSIBLE |
user output |
---|
IMPOSSIBLE |
Test 8
Verdict: ACCEPTED
input |
---|
6 8 |
correct output |
---|
IMPOSSIBLE |
user output |
---|
IMPOSSIBLE |
Test 9
Verdict: ACCEPTED
input |
---|
7 4 |
correct output |
---|
IMPOSSIBLE |
user output |
---|
IMPOSSIBLE |
Test 10
Verdict: ACCEPTED
input |
---|
5 10 |
correct output |
---|
POSSIBLE 0000 0110 0110 0100 ... |
user output |
---|
POSSIBLE 0000 0110 0110 0100 ... |
Test 11
Verdict: ACCEPTED
input |
---|
10 25 |
correct output |
---|
IMPOSSIBLE |
user output |
---|
IMPOSSIBLE |
Test 12
Verdict: ACCEPTED
input |
---|
10 22 |
correct output |
---|
POSSIBLE 000 010 010 010 ... |
user output |
---|
POSSIBLE 0000000 0111110 0100000 0100000 ... |
Test 13
Verdict: ACCEPTED
input |
---|
10 14 |
correct output |
---|
POSSIBLE 0000 0110 0110 0110 ... |
user output |
---|
POSSIBLE 00000 01110 01110 01110 ... |
Test 14
Verdict: ACCEPTED
input |
---|
10 6 |
correct output |
---|
IMPOSSIBLE |
user output |
---|
IMPOSSIBLE |
Test 15
Verdict: ACCEPTED
input |
---|
10 37 |
correct output |
---|
IMPOSSIBLE |
user output |
---|
IMPOSSIBLE |
Test 16
Verdict: ACCEPTED
input |
---|
10 12 |
correct output |
---|
IMPOSSIBLE |
user output |
---|
IMPOSSIBLE |
Test 17
Verdict: ACCEPTED
input |
---|
10 39 |
correct output |
---|
IMPOSSIBLE |
user output |
---|
IMPOSSIBLE |
Test 18
Verdict: ACCEPTED
input |
---|
10 14 |
correct output |
---|
POSSIBLE 0000 0110 0110 0110 ... |
user output |
---|
POSSIBLE 00000 01110 01110 01110 ... |
Test 19
Verdict: ACCEPTED
input |
---|
10 4 |
correct output |
---|
IMPOSSIBLE |
user output |
---|
IMPOSSIBLE |
Test 20
Verdict: ACCEPTED
input |
---|
10 16 |
correct output |
---|
POSSIBLE 00000000 01111110 01111000 00000000 |
user output |
---|
POSSIBLE 000000 011110 011110 010000 ... |
Test 21
Verdict: ACCEPTED
input |
---|
100 239 |
correct output |
---|
IMPOSSIBLE |
user output |
---|
IMPOSSIBLE |
Test 22
Verdict: ACCEPTED
input |
---|
100 202 |
correct output |
---|
POSSIBLE 000 010 010 010 ... |
user output |
---|
POSSIBLE 000000000000000000000000000000... Truncated |
Test 23
Verdict: ACCEPTED
input |
---|
100 70 |
correct output |
---|
POSSIBLE 000000000000000000000000000000... |
user output |
---|
POSSIBLE 0000000000000000000 0111111111111111110 0111111111111111110 0111111111111111110 ... Truncated |
Test 24
Verdict: ACCEPTED
input |
---|
100 32 |
correct output |
---|
IMPOSSIBLE |
user output |
---|
IMPOSSIBLE |
Test 25
Verdict: ACCEPTED
input |
---|
100 361 |
correct output |
---|
IMPOSSIBLE |
user output |
---|
IMPOSSIBLE |
Test 26
Verdict: ACCEPTED
input |
---|
100 48 |
correct output |
---|
POSSIBLE 00000000000000000000 01111111111111111110 01111111111111111110 01111111111111111110 ... |
user output |
---|
POSSIBLE 00000000000000 01111111111110 01111111111110 01111111111110 ... Truncated |
Test 27
Verdict: ACCEPTED
input |
---|
100 380 |
correct output |
---|
IMPOSSIBLE |
user output |
---|
IMPOSSIBLE |
Test 28
Verdict: ACCEPTED
input |
---|
100 76 |
correct output |
---|
POSSIBLE 000000000000000000000000000000... |
user output |
---|
POSSIBLE 000000000000000000000 011111111111111111110 011111111111111111110 011111111111111 ... Truncated |
Test 29
Verdict: ACCEPTED
input |
---|
100 8 |
correct output |
---|
IMPOSSIBLE |
user output |
---|
IMPOSSIBLE |
Test 30
Verdict: ACCEPTED
input |
---|
100 98 |
correct output |
---|
POSSIBLE 000000000000000000000000000000... |
user output |
---|
POSSIBLE 00000000000000000000000000 01111111111111111111111110 01111111111111111111111110 ... Truncated |
Test 31
Verdict: ACCEPTED
input |
---|
200 476 |
correct output |
---|
IMPOSSIBLE |
user output |
---|
IMPOSSIBLE |
Test 32
Verdict: ACCEPTED
input |
---|
200 402 |
correct output |
---|
POSSIBLE 000 010 010 010 ... |
user output |
---|
POSSIBLE 000000000000000000000000000000... Truncated |
Test 33
Verdict: ACCEPTED
input |
---|
200 120 |
correct output |
---|
POSSIBLE 000000000000000000000000000000... |
user output |
---|
POSSIBLE 000000000000000000000000000000... Truncated |
Test 34
Verdict: ACCEPTED
input |
---|
200 60 |
correct output |
---|
POSSIBLE 000000000000 011111111110 011111111110 011111111110 ... |
user output |
---|
POSSIBLE 00000000000000000 01111111111111110 01111111111111110 01111111111111110 ... Truncated |
Test 35
Verdict: ACCEPTED
input |
---|
200 721 |
correct output |
---|
IMPOSSIBLE |
user output |
---|
IMPOSSIBLE |
Test 36
Verdict: ACCEPTED
input |
---|
200 74 |
correct output |
---|
POSSIBLE 000000000000000000000000000000... |
user output |
---|
POSSIBLE 00000000000000000000 01111111111111111110 01111111111111111110 011111111111111111 ... Truncated |
Test 37
Verdict: ACCEPTED
input |
---|
200 759 |
correct output |
---|
IMPOSSIBLE |
user output |
---|
IMPOSSIBLE |
Test 38
Verdict: ACCEPTED
input |
---|
200 134 |
correct output |
---|
POSSIBLE 000000000000000000000000000000... |
user output |
---|
POSSIBLE 000000000000000000000000000000... Truncated |
Test 39
Verdict: ACCEPTED
input |
---|
200 12 |
correct output |
---|
IMPOSSIBLE |
user output |
---|
IMPOSSIBLE |
Test 40
Verdict: ACCEPTED
input |
---|
200 182 |
correct output |
---|
POSSIBLE 000000000000000000000000000000... |
user output |
---|
POSSIBLE 000000000000000000000000000000... Truncated |
Test 41
Verdict: ACCEPTED
input |
---|
1000 2373 |
correct output |
---|
IMPOSSIBLE |
user output |
---|
IMPOSSIBLE |
Test 42
Verdict: ACCEPTED
input |
---|
1000 1998 |
correct output |
---|
POSSIBLE 000000000000000000000000000000... |
user output |
---|
POSSIBLE 000000000000000000000000000000... Truncated |
Test 43
Verdict: ACCEPTED
input |
---|
1000 472 |
correct output |
---|
POSSIBLE 000000000000000000000000000000... |
user output |
---|
POSSIBLE 000000000000000000000000000000... Truncated |
Test 44
Verdict: ACCEPTED
input |
---|
1000 286 |
correct output |
---|
POSSIBLE 000000000000000000000000000000... |
user output |
---|
POSSIBLE 000000000000000000000000000000... Truncated |
Test 45
Verdict: ACCEPTED
input |
---|
1000 3603 |
correct output |
---|
IMPOSSIBLE |
user output |
---|
IMPOSSIBLE |
Test 46
Verdict: ACCEPTED
input |
---|
1000 228 |
correct output |
---|
POSSIBLE 000000000000000000000000000000... |
user output |
---|
POSSIBLE 000000000000000000000000000000... Truncated |
Test 47
Verdict: ACCEPTED
input |
---|
1000 3791 |
correct output |
---|
IMPOSSIBLE |
user output |
---|
IMPOSSIBLE |
Test 48
Verdict: ACCEPTED
input |
---|
1000 552 |
correct output |
---|
POSSIBLE 000000000000000000000000000000... |
user output |
---|
POSSIBLE 000000000000000000000000000000... Truncated |
Test 49
Verdict: ACCEPTED
input |
---|
1000 48 |
correct output |
---|
IMPOSSIBLE |
user output |
---|
IMPOSSIBLE |
Test 50
Verdict: ACCEPTED
input |
---|
1000 810 |
correct output |
---|
POSSIBLE 000000000000000000000000000000... |
user output |
---|
POSSIBLE 000000000000000000000000000000... Truncated |