Task: | Omenat |
Sender: | |
Submission time: | 2015-12-20 21:50:19 +0200 |
Language: | C++ |
Status: | READY |
Result: | 0 |
group | verdict | score |
---|---|---|
#1 | RUNTIME ERROR | 4.3 |
test | verdict | time | score | |
---|---|---|---|---|
#1 | ACCEPTED | 0.05 s | 0.4 | details |
#2 | RUNTIME ERROR | 0.14 s | 0 | details |
#3 | RUNTIME ERROR | 0.16 s | 0 | details |
#4 | ACCEPTED | 0.05 s | 1.5 | details |
#5 | RUNTIME ERROR | 0.15 s | 0 | details |
#6 | RUNTIME ERROR | 0.15 s | 0 | details |
#7 | RUNTIME ERROR | 0.17 s | 0 | details |
#8 | ACCEPTED | 0.05 s | 1 | details |
#9 | RUNTIME ERROR | 0.15 s | 0 | details |
#10 | ACCEPTED | 0.06 s | 1.4 | details |
Compiler report
input/code.cpp: In member function 'int TXD::Set(int, int)': input/code.cpp:22:3: warning: no return statement in function returning non-void [-Wreturn-type] } ^ input/code.cpp: In function 'int main()': input/code.cpp:82:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for (int i=0; i<txds.size(); ++i){ ^ input/code.cpp:89:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for (int i=0; i<txds.size(); ++i) ^
Code
#include <iostream> #include <vector> using namespace std; int n; int p[101]; class TXD{ unsigned long long a[1010][2]; unsigned long long n[1010][2]; int M; int T; public: bool found; int Set(int v, int t){ M=v; T=t%M; for (int i=0; i<M; ++i){ a[i][0]=0; a[i][1]=0;} for (int i=0; i<M; ++i){ n[i][0]=0; n[i][1]=0;} a[0][1]|=(1ull<<63); } void Push(int id){ unsigned long long c=0; if (id<64) c|=(1ull<<id); else c|=(1ull<<(id-64)); for (int i=0; i<M; ++i){ if (a[i][1]&(1ull<<63)){ int nid=(i+p[id])%M; n[nid][0]=a[i][0]; n[nid][1]=a[i][1]; if (i<64)n[nid][0]|=c; else n[nid][1]|=c; } } for (int i=0; i<M; ++i){ if (n[i][0] || n[i][1]){ a[i][1]|=(1ull<<63); a[i][0]|=n[i][0]; a[i][1]|=n[i][1]; n[i][0]=0; n[i][1]=1; } } if (a[T][1]&(1ull<<63)) found=1; } unsigned long long GetTV(int i){ return a[T][i]; } TXD(){ found=0; } }; vector<TXD> txds; long long s; void Texi(int i){ TXD k; k.Set(i, s/2); txds.push_back(k); } int main(){ cin >> n; for (int i=0; i<n; ++i){ cin >> p[i]; s+=p[i]; } for (int i=2; i<1010; i*=2) Texi(i); int ci=0; bool ready=0; unsigned long long sc[2]; while (1){ ready=1; for (int i=0; i<txds.size(); ++i){ txds[i].Push(ci); ready=ready && txds[i].found; } ++ci; if (ready){ sc[0]=0; sc[1]=0; --sc[0]; --sc[1]; for (int i=0; i<txds.size(); ++i) for (int b=0; b<2; ++b) sc[b]&=txds[i].GetTV(b); long long sts=0; for (int i=0; i<n; ++i){ bool is=0; if (i<64) is=(sc[0]&(1ull<<i)); else is=(sc[0]&(1ull<<(i-64))); if (is) sts+=p[i]; } if (sts>=s/2) break; } } for (int i=0; i<n; ++i){ bool is=0; if (i<64) is=(sc[0]&(1ull<<i)); else is=(sc[0]&(1ull<<(i-64))); cout << (is?1:2) << "\n"; } }
Test details
Test 1
Verdict: ACCEPTED
input |
---|
95 779724552 231968220 985023789 ... |
correct output |
---|
(empty) |
user output |
---|
1 1 1 1 1 ... |
Test 2
Verdict: RUNTIME ERROR
input |
---|
85 229722261 51722691 862338862 8... |
correct output |
---|
(empty) |
user output |
---|
(empty) |
Test 3
Verdict: RUNTIME ERROR
input |
---|
97 398995377 989444445 634573915 ... |
correct output |
---|
(empty) |
user output |
---|
(empty) |
Test 4
Verdict: ACCEPTED
input |
---|
99 843687873 164010938 51269970 4... |
correct output |
---|
(empty) |
user output |
---|
1 1 1 1 1 ... |
Test 5
Verdict: RUNTIME ERROR
input |
---|
90 864611617 418460939 773297829 ... |
correct output |
---|
(empty) |
user output |
---|
(empty) |
Test 6
Verdict: RUNTIME ERROR
input |
---|
92 289890246 25801423 763027596 7... |
correct output |
---|
(empty) |
user output |
---|
(empty) |
Test 7
Verdict: RUNTIME ERROR
input |
---|
89 879039800 50522278 850785072 4... |
correct output |
---|
(empty) |
user output |
---|
(empty) |
Test 8
Verdict: ACCEPTED
input |
---|
96 27192469 222283781 681532515 1... |
correct output |
---|
(empty) |
user output |
---|
1 1 1 1 1 ... |
Test 9
Verdict: RUNTIME ERROR
input |
---|
100 186459081 254674429 394007236 ... |
correct output |
---|
(empty) |
user output |
---|
(empty) |
Test 10
Verdict: ACCEPTED
input |
---|
98 612168861 979831717 671087051 ... |
correct output |
---|
(empty) |
user output |
---|
1 1 1 1 1 ... |