Submission #905398
Source Code Expand
#include <cstdio> #include <cmath> #include <iostream> #include <set> #include <algorithm> #include <vector> #include <map> #include <cassert> #include <string> #include <cstring> #include <queue> using namespace std; #define rep(i,a,b) for(int i = a; i < b; i++) #define S(x) scanf("%d",&x) #define S2(x,y) scanf("%d%d",&x,&y) #define P(x) printf("%d\n",x) #define all(v) v.begin(),v.end() #define FF first #define SS second typedef long long int LL; typedef pair<int, int > pii; typedef vector<int > vi; const int N = 101; int A[N], cnt[N]; int main() { int n; S(n); int mx = 0; rep(i,1,n+1) { S(A[i]); mx = max(mx,A[i]); cnt[A[i]]++; } if(cnt[mx] < 2) { printf("Impossible\n"); return 0; } int half = (mx + 1) / 2; if(mx & 1) { if(cnt[half] != 2) { printf("Impossible\n"); return 0; } } else { if(cnt[half] != 1) { printf("Impossible\n"); return 0; } } rep(i,half+1,mx) { if(cnt[i] < 2) { printf("Impossible\n"); return 0; } } rep(i,1,n+1) { if(A[i] < half) { printf("Impossible\n"); return 0; } } printf("Possible\n"); return 0; }
Submission Info
Submission Time | |
---|---|
Task | C - Tree Restoring |
User | akashdeep |
Language | C++14 (GCC 5.4.1) |
Score | 700 |
Code Size | 1255 Byte |
Status | AC |
Exec Time | 3 ms |
Memory | 256 KB |
Compile Error
./Main.cpp: In function ‘int main()’: ./Main.cpp:33:7: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] S(n); ^ ./Main.cpp:36:12: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] S(A[i]); ^
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 700 / 700 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | example0, example1, example2, example3, example4, example5 |
All | almostline0, almostline1, almostline2, almostline3, can0, can1, can2, can3, can4, can5, can6, deg0, deg1, deg2, deg3, example0, example1, example2, example3, example4, example5, handmade0, line0, line1, line2, line3, ng10, ng11, ng12, ng13, ng20, ng21, ng22, ng23, plus0, plus1, plus2, plus3, rand0, rand1, rand2, star0, star1, star2, star3 |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
almostline0 | AC | 3 ms | 256 KB |
almostline1 | AC | 3 ms | 256 KB |
almostline2 | AC | 2 ms | 256 KB |
almostline3 | AC | 2 ms | 256 KB |
can0 | AC | 2 ms | 256 KB |
can1 | AC | 2 ms | 256 KB |
can2 | AC | 2 ms | 256 KB |
can3 | AC | 2 ms | 256 KB |
can4 | AC | 2 ms | 256 KB |
can5 | AC | 2 ms | 256 KB |
can6 | AC | 2 ms | 256 KB |
deg0 | AC | 3 ms | 256 KB |
deg1 | AC | 2 ms | 256 KB |
deg2 | AC | 2 ms | 256 KB |
deg3 | AC | 2 ms | 256 KB |
example0 | AC | 2 ms | 256 KB |
example1 | AC | 2 ms | 256 KB |
example2 | AC | 2 ms | 256 KB |
example3 | AC | 2 ms | 256 KB |
example4 | AC | 2 ms | 256 KB |
example5 | AC | 2 ms | 256 KB |
handmade0 | AC | 2 ms | 256 KB |
line0 | AC | 2 ms | 256 KB |
line1 | AC | 2 ms | 256 KB |
line2 | AC | 2 ms | 256 KB |
line3 | AC | 3 ms | 256 KB |
ng10 | AC | 3 ms | 256 KB |
ng11 | AC | 2 ms | 256 KB |
ng12 | AC | 2 ms | 256 KB |
ng13 | AC | 2 ms | 256 KB |
ng20 | AC | 2 ms | 256 KB |
ng21 | AC | 2 ms | 256 KB |
ng22 | AC | 3 ms | 256 KB |
ng23 | AC | 2 ms | 256 KB |
plus0 | AC | 2 ms | 256 KB |
plus1 | AC | 2 ms | 256 KB |
plus2 | AC | 2 ms | 256 KB |
plus3 | AC | 2 ms | 256 KB |
rand0 | AC | 2 ms | 256 KB |
rand1 | AC | 2 ms | 256 KB |
rand2 | AC | 2 ms | 256 KB |
star0 | AC | 2 ms | 256 KB |
star1 | AC | 2 ms | 256 KB |
star2 | AC | 2 ms | 256 KB |
star3 | AC | 2 ms | 256 KB |