Task: | Modern art |
Sender: | bubu2006 |
Submission time: | 2024-11-11 17:21:48 +0200 |
Language: | C++ (C++20) |
Status: | READY |
Result: | WRONG ANSWER |
test | verdict | time | |
---|---|---|---|
#1 | ACCEPTED | 0.00 s | details |
#2 | WRONG ANSWER | 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 | WRONG ANSWER | 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 | WRONG ANSWER | 0.00 s | details |
#21 | ACCEPTED | 0.00 s | details |
#22 | WRONG ANSWER | 0.00 s | details |
#23 | WRONG ANSWER | 0.00 s | details |
#24 | ACCEPTED | 0.00 s | details |
#25 | ACCEPTED | 0.00 s | details |
#26 | WRONG ANSWER | 0.00 s | details |
#27 | ACCEPTED | 0.00 s | details |
#28 | WRONG ANSWER | 0.00 s | details |
#29 | ACCEPTED | 0.00 s | details |
#30 | WRONG ANSWER | 0.00 s | details |
#31 | ACCEPTED | 0.00 s | details |
#32 | WRONG ANSWER | 0.00 s | details |
#33 | WRONG ANSWER | 0.00 s | details |
#34 | WRONG ANSWER | 0.00 s | details |
#35 | ACCEPTED | 0.00 s | details |
#36 | WRONG ANSWER | 0.00 s | details |
#37 | ACCEPTED | 0.00 s | details |
#38 | WRONG ANSWER | 0.00 s | details |
#39 | ACCEPTED | 0.00 s | details |
#40 | WRONG ANSWER | 0.00 s | details |
#41 | ACCEPTED | 0.00 s | details |
#42 | WRONG ANSWER | 0.02 s | details |
#43 | WRONG ANSWER | 0.00 s | details |
#44 | WRONG ANSWER | 0.00 s | details |
#45 | ACCEPTED | 0.00 s | details |
#46 | WRONG ANSWER | 0.00 s | details |
#47 | ACCEPTED | 0.00 s | details |
#48 | WRONG ANSWER | 0.01 s | details |
#49 | ACCEPTED | 0.00 s | details |
#50 | WRONG ANSWER | 0.01 s | details |
Code
#include <bits/stdc++.h> #include <iomanip> #include <vector> using namespace std; #define int long long #define rep(i, a, b) for(int i = a; i < (b); ++i) #define all(x) begin(x), end(x) #define sz(x) (int)(x).size() typedef long long ll; typedef pair<int, int> pii; typedef vector<int> vi; /** * Author: Ulf Lundstrom * Date: 2009-02-26 * License: CC0 * Source: My head with inspiration from tinyKACTL * Description: Class to handle points in the plane. * T can be e.g. double or long long. (Avoid int.) * Status: Works fine, used a lot */ template <class T> int sgn(T x) { return (x > 0) - (x < 0); } template<class T> struct Point { typedef Point P; T x, y; explicit Point(T x=0, T y=0) : x(x), y(y) {} bool operator<(P p) const { return tie(x,y) < tie(p.x,p.y); } bool operator==(P p) const { return tie(x,y)==tie(p.x,p.y); } P operator+(P p) const { return P(x+p.x, y+p.y); } P operator-(P p) const { return P(x-p.x, y-p.y); } P operator*(T d) const { return P(x*d, y*d); } P operator/(T d) const { return P(x/d, y/d); } T dot(P p) const { return x*p.x + y*p.y; } T cross(P p) const { return x*p.y - y*p.x; } T cross(P a, P b) const { return (a-*this).cross(b-*this); } T dist2() const { return x*x + y*y; } double dist() const { return sqrt((double)dist2()); } // angle to x-axis in interval [-pi, pi] double angle() const { return atan2(y, x); } P unit() const { return *this/dist(); } // makes dist()=1 P perp() const { return P(-y, x); } // rotates +90 degrees P normal() const { return perp().unit(); } // returns point rotated 'a' radians ccw around the origin P rotate(double a) const { return P(x*cos(a)-y*sin(a),x*sin(a)+y*cos(a)); } friend ostream& operator<<(ostream& os, P p) { return os << "(" << p.x << "," << p.y << ")"; } }; template<class T> T polygonArea2(vector<Point<T>>& v) { T a = v.back().cross(v[0]); rep(i,0,sz(v)-1) a += v[i].cross(v[i+1]); return a; } struct UF { vi e; UF(int n) : e(n, -1) {} bool sameSet(int a, int b) { return find(a) == find(b); } int size(int x) { return -e[find(x)]; } int find(int x) { return e[x] < 0 ? x : e[x] = find(e[x]); } bool join(int a, int b) { a = find(a), b = find(b); if (a == b) return false; if (e[a] > e[b]) swap(a, b); e[a] += e[b]; e[b] = a; return true; } }; const int di[] = {0, 0, -1, 1}; const int dj[] = {-1, 1, 0, 0}; signed main() { cin.tie(0)->sync_with_stdio(0); cin.exceptions(cin.failbit); // RTE if input wrong datatype int a, p; cin >> a >> p; if (p & 1) { cout << "IMPOSSIBLE"; return 0; } int mina = (p / 2) - 1; int maxa = ((p / 2) / 2) * ((p / 2 + 1) / 2); if (a < mina || a > maxa) { cout << "IMPOSSIBLE"; return 0; } cout << "POSSIBLE\n"; int h = (p / 2) / 2; int w = (p / 2 + 1) / 2; vector<vi> ans(h + 2, vi(w + 2)); for (int i = 1; i <= h; i++) { for (int j = 1; j <= w; j++) { if (a) { a--; ans[i][j] = 1; } } } for (int i = 0; i < h + 2; i++) { for (int j = 0; j < w + 2; j++) { cout << ans[i][j]; } cout << '\n'; } }
Test details
Test 1
Verdict: ACCEPTED
input |
---|
5 14 |
correct output |
---|
IMPOSSIBLE |
user output |
---|
IMPOSSIBLE |
Test 2
Verdict: WRONG ANSWER
input |
---|
6 14 |
correct output |
---|
POSSIBLE 000 010 010 010 ... |
user output |
---|
POSSIBLE 000000 011110 011000 000000 ... |
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 00000 01110 01100 00000 |
Test 11
Verdict: ACCEPTED
input |
---|
10 25 |
correct output |
---|
IMPOSSIBLE |
user output |
---|
IMPOSSIBLE |
Test 12
Verdict: WRONG ANSWER
input |
---|
10 22 |
correct output |
---|
POSSIBLE 000 010 010 010 ... |
user output |
---|
POSSIBLE 00000000 01111110 01111000 00000000 ... |
Test 13
Verdict: ACCEPTED
input |
---|
10 14 |
correct output |
---|
POSSIBLE 0000 0110 0110 0110 ... |
user output |
---|
POSSIBLE 000000 011110 011110 011000 ... |
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 000000 011110 011110 011000 ... |
Test 19
Verdict: ACCEPTED
input |
---|
10 4 |
correct output |
---|
IMPOSSIBLE |
user output |
---|
IMPOSSIBLE |
Test 20
Verdict: WRONG ANSWER
input |
---|
10 16 |
correct output |
---|
POSSIBLE 00000000 01111110 01111000 00000000 |
user output |
---|
POSSIBLE 000000 011110 011110 011000 ... |
Test 21
Verdict: ACCEPTED
input |
---|
100 239 |
correct output |
---|
IMPOSSIBLE |
user output |
---|
IMPOSSIBLE |
Test 22
Verdict: WRONG ANSWER
input |
---|
100 202 |
correct output |
---|
POSSIBLE 000 010 010 010 ... |
user output |
---|
POSSIBLE 000000000000000000000000000000... |
Test 23
Verdict: WRONG ANSWER
input |
---|
100 70 |
correct output |
---|
POSSIBLE 000000000000000000000000000000... |
user output |
---|
POSSIBLE 00000000000000000000 01111111111111111110 01111111111111111110 01111111111111111110 ... |
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: WRONG ANSWER
input |
---|
100 48 |
correct output |
---|
POSSIBLE 00000000000000000000 01111111111111111110 01111111111111111110 01111111111111111110 ... |
user output |
---|
POSSIBLE 00000000000000 01111111111110 01111111111110 01111111111110 ... |
Test 27
Verdict: ACCEPTED
input |
---|
100 380 |
correct output |
---|
IMPOSSIBLE |
user output |
---|
IMPOSSIBLE |
Test 28
Verdict: WRONG ANSWER
input |
---|
100 76 |
correct output |
---|
POSSIBLE 000000000000000000000000000000... |
user output |
---|
POSSIBLE 000000000000000000000 011111111111111111110 011111111111111111110 011111111111111111110 ... |
Test 29
Verdict: ACCEPTED
input |
---|
100 8 |
correct output |
---|
IMPOSSIBLE |
user output |
---|
IMPOSSIBLE |
Test 30
Verdict: WRONG ANSWER
input |
---|
100 98 |
correct output |
---|
POSSIBLE 000000000000000000000000000000... |
user output |
---|
POSSIBLE 000000000000000000000000000 011111111111111111111111110 011111111111111111111111110 011111111111111111111111110 ... |
Test 31
Verdict: ACCEPTED
input |
---|
200 476 |
correct output |
---|
IMPOSSIBLE |
user output |
---|
IMPOSSIBLE |
Test 32
Verdict: WRONG ANSWER
input |
---|
200 402 |
correct output |
---|
POSSIBLE 000 010 010 010 ... |
user output |
---|
POSSIBLE 000000000000000000000000000000... |
Test 33
Verdict: WRONG ANSWER
input |
---|
200 120 |
correct output |
---|
POSSIBLE 000000000000000000000000000000... |
user output |
---|
POSSIBLE 000000000000000000000000000000... |
Test 34
Verdict: WRONG ANSWER
input |
---|
200 60 |
correct output |
---|
POSSIBLE 000000000000 011111111110 011111111110 011111111110 ... |
user output |
---|
POSSIBLE 00000000000000000 01111111111111110 01111111111111110 01111111111111110 ... |
Test 35
Verdict: ACCEPTED
input |
---|
200 721 |
correct output |
---|
IMPOSSIBLE |
user output |
---|
IMPOSSIBLE |
Test 36
Verdict: WRONG ANSWER
input |
---|
200 74 |
correct output |
---|
POSSIBLE 000000000000000000000000000000... |
user output |
---|
POSSIBLE 000000000000000000000 011111111111111111110 011111111111111111110 011111111111111111110 ... |
Test 37
Verdict: ACCEPTED
input |
---|
200 759 |
correct output |
---|
IMPOSSIBLE |
user output |
---|
IMPOSSIBLE |
Test 38
Verdict: WRONG ANSWER
input |
---|
200 134 |
correct output |
---|
POSSIBLE 000000000000000000000000000000... |
user output |
---|
POSSIBLE 000000000000000000000000000000... |
Test 39
Verdict: ACCEPTED
input |
---|
200 12 |
correct output |
---|
IMPOSSIBLE |
user output |
---|
IMPOSSIBLE |
Test 40
Verdict: WRONG ANSWER
input |
---|
200 182 |
correct output |
---|
POSSIBLE 000000000000000000000000000000... |
user output |
---|
POSSIBLE 000000000000000000000000000000... |
Test 41
Verdict: ACCEPTED
input |
---|
1000 2373 |
correct output |
---|
IMPOSSIBLE |
user output |
---|
IMPOSSIBLE |
Test 42
Verdict: WRONG ANSWER
input |
---|
1000 1998 |
correct output |
---|
POSSIBLE 000000000000000000000000000000... |
user output |
---|
POSSIBLE 000000000000000000000000000000... |
Test 43
Verdict: WRONG ANSWER
input |
---|
1000 472 |
correct output |
---|
POSSIBLE 000000000000000000000000000000... |
user output |
---|
POSSIBLE 000000000000000000000000000000... |
Test 44
Verdict: WRONG ANSWER
input |
---|
1000 286 |
correct output |
---|
POSSIBLE 000000000000000000000000000000... |
user output |
---|
POSSIBLE 000000000000000000000000000000... |
Test 45
Verdict: ACCEPTED
input |
---|
1000 3603 |
correct output |
---|
IMPOSSIBLE |
user output |
---|
IMPOSSIBLE |
Test 46
Verdict: WRONG ANSWER
input |
---|
1000 228 |
correct output |
---|
POSSIBLE 000000000000000000000000000000... |
user output |
---|
POSSIBLE 000000000000000000000000000000... |
Test 47
Verdict: ACCEPTED
input |
---|
1000 3791 |
correct output |
---|
IMPOSSIBLE |
user output |
---|
IMPOSSIBLE |
Test 48
Verdict: WRONG ANSWER
input |
---|
1000 552 |
correct output |
---|
POSSIBLE 000000000000000000000000000000... |
user output |
---|
POSSIBLE 000000000000000000000000000000... |
Test 49
Verdict: ACCEPTED
input |
---|
1000 48 |
correct output |
---|
IMPOSSIBLE |
user output |
---|
IMPOSSIBLE |
Test 50
Verdict: WRONG ANSWER
input |
---|
1000 810 |
correct output |
---|
POSSIBLE 000000000000000000000000000000... |
user output |
---|
POSSIBLE 000000000000000000000000000000... |