Task: | dobri |
Sender: | eXeP |
Submission time: | 2016-08-02 15:36:45 +0300 |
Language: | C++ |
Status: | READY |
Result: | 0 |
group | verdict | score |
---|---|---|
#1 | WRONG ANSWER | 0 |
test | verdict | time | |
---|---|---|---|
#1 | ACCEPTED | 0.06 s | details |
#2 | ACCEPTED | 0.06 s | details |
#3 | ACCEPTED | 0.05 s | details |
#4 | WRONG ANSWER | 0.06 s | details |
#5 | WRONG ANSWER | 0.06 s | details |
#6 | WRONG ANSWER | 0.07 s | details |
#7 | WRONG ANSWER | 0.06 s | details |
#8 | ACCEPTED | 0.42 s | details |
#9 | ACCEPTED | 0.41 s | details |
#10 | ACCEPTED | 0.39 s | details |
#11 | TIME LIMIT EXCEEDED | -- | details |
#12 | TIME LIMIT EXCEEDED | -- | details |
#13 | TIME LIMIT EXCEEDED | -- | details |
Code
#include <bits/stdc++.h> #define i64 long long #define u64 unsigned long long #define i32 int #define u32 unsigned int #define pii pair<int, int> #define pll pair<long long, long long> #define ld long double #define defmod 1000000007 #define mati64(a,b) vector<vector<i64>>(a, vector<i64>(b, 0)); using namespace std; int main(){ cin.sync_with_stdio(0); cin.tie(0); int n; cin >> n; int a[5050]; for(int i = 0; i < n; ++i) cin >> a[i]; set<int> lel[4]; lel[1].insert(a[0]); lel[2].insert(a[0]*2); lel[3].insert(a[0]*3); int ans = 0; for(int i = 1; i < n; ++i){ if(lel[3].count(a[i])) ans++; for(auto f: lel[2]){ if(f+a[i] >= -100000 && f+a[i] <= 100000) lel[3].insert(f+a[i]); } for(auto f: lel[1]){ if(f+a[i] >= -200000 && f+a[i] <= 200000) lel[2].insert(f+a[i]); if(f+2*a[i] >= -100000 && f+2*a[i] <= 100000) lel[3].insert(f+a[i]); } lel[1].insert(a[i]); lel[2].insert(a[i]*2); lel[3].insert(a[i]*3); } cout << ans << endl; return 0; }
Test details
Test 1
Verdict: ACCEPTED
input |
---|
2
1 3 |
correct output |
---|
1 |
user output |
---|
1 |
Test 2
Verdict: ACCEPTED
input |
---|
6
1 2 3 5 7 10 |
correct output |
---|
4 |
user output |
---|
4 |
Test 3
Verdict: ACCEPTED
input |
---|
3
-1 2 0 |
correct output |
---|
1 |
user output |
---|
1 |
Test 4
Verdict: WRONG ANSWER
input |
---|
50
16291 48873 -24113 647 25407 7... |
correct output |
---|
17 |
user output |
---|
15 |
Test 5
Verdict: WRONG ANSWER
input |
---|
50
28605 44105 100000 15416 10000... |
correct output |
---|
6 |
user output |
---|
5 |
Test 6
Verdict: WRONG ANSWER
input |
---|
50
33946 -4739 33938 48034 100000... |
correct output |
---|
5 |
user output |
---|
4 |
Test 7
Verdict: WRONG ANSWER
input |
---|
50
47168 -43373 45399 49194 6990 ... |
correct output |
---|
21 |
user output |
---|
20 |
Test 8
Verdict: ACCEPTED
input |
---|
500
1 3 9 27 39 117 351 1053 1521 ... |
correct output |
---|
445 |
user output |
---|
445 |
Test 9
Verdict: ACCEPTED
input |
---|
500
1 3 9 27 81 243 351 1053 3159 ... |
correct output |
---|
448 |
user output |
---|
448 |
Test 10
Verdict: ACCEPTED
input |
---|
500
1 3 9 27 39 75 225 675 975 292... |
correct output |
---|
444 |
user output |
---|
444 |
Test 11
Verdict: TIME LIMIT EXCEEDED
input |
---|
5000
1 3 9 27 39 117 351 507 1521 4... |
correct output |
---|
4664 |
user output |
---|
(empty) |
Test 12
Verdict: TIME LIMIT EXCEEDED
input |
---|
5000
1 3 9 27 39 75 225 339 1017 30... |
correct output |
---|
4455 |
user output |
---|
(empty) |
Test 13
Verdict: TIME LIMIT EXCEEDED
input |
---|
5000
1 3 9 13 25 47 85 157 289 531 ... |
correct output |
---|
4436 |
user output |
---|
(empty) |