Task: | Menu |
Sender: | Kyynel ;_; |
Submission time: | 2016-09-27 18:53:03 +0300 |
Language: | C++ |
Status: | READY |
Result: | WRONG ANSWER |
test | verdict | time | |
---|---|---|---|
#1 | WRONG ANSWER | 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.05 s | details |
#6 | TIME LIMIT EXCEEDED | -- | details |
#7 | TIME LIMIT EXCEEDED | -- | details |
#8 | TIME LIMIT EXCEEDED | -- | details |
#9 | TIME LIMIT EXCEEDED | -- | details |
#10 | TIME LIMIT EXCEEDED | -- | details |
#11 | TIME LIMIT EXCEEDED | -- | details |
#12 | TIME LIMIT EXCEEDED | -- | details |
#13 | TIME LIMIT EXCEEDED | -- | details |
#14 | TIME LIMIT EXCEEDED | -- | details |
#15 | TIME LIMIT EXCEEDED | -- | details |
#16 | TIME LIMIT EXCEEDED | -- | details |
#17 | TIME LIMIT EXCEEDED | -- | details |
#18 | TIME LIMIT EXCEEDED | -- | details |
#19 | TIME LIMIT EXCEEDED | -- | details |
#20 | TIME LIMIT EXCEEDED | -- | details |
Code
#include <bits/stdc++.h> #define ll long long #define M 1000000007 #define N 2000 using namespace std; ll p[N]; ll w[N]; ll ans = 0; map<ll, ll> m; set<pair<ll, pair<int, int>>> s; int main () { cin.sync_with_stdio(false); cin.tie(0); int n; cin>>n; for (int i = 0; i < n; i++) cin>>p[i]>>w[i]; ans = n; for (int i = 0; i < n; i++) { for (int j = i + 1; j < n; j++) { if (p[i] != p[j] && w[i] != w[j]) { if ((p[i] > p[j]) != (w[i] > w[j])) ans++, s.insert({max(p[i] + w[i], p[j] + w[j]), {i, j}}); } } } ll pr = 0; for (auto x : m) { m[x.first] += m[pr]; pr = x.first; } for (int i = 0; i < n; i++) { for (auto e : s) { int x = e.second.first; int y = e.second.second; if (x == i || y == i) continue; if ((p[i] < p[x]) == (p[i] < p[y]) || (w[i] < w[x]) == (w[i] < w[y])) continue; if (p[i] + w[i] >= e.first) { ans = (ans + 1) % M; } else { break; } } } cout<<ans<<endl; }
Test details
Test 1
Verdict: WRONG ANSWER
input |
---|
10 850 133 2763 5656 9522 6414 4632 111 ... |
correct output |
---|
44 |
user output |
---|
38 |
Test 2
Verdict: ACCEPTED
input |
---|
3 879282715 862952675 142871964 472161713 988317255 547546326 |
correct output |
---|
4 |
user output |
---|
4 |
Test 3
Verdict: ACCEPTED
input |
---|
1 31 27 |
correct output |
---|
1 |
user output |
---|
1 |
Test 4
Verdict: WRONG ANSWER
input |
---|
5 3462 9731 5901 2934 9200 621 6596 6299 ... |
correct output |
---|
20 |
user output |
---|
14 |
Test 5
Verdict: WRONG ANSWER
input |
---|
9 754505708 807490279 346126190 983884810 989702075 729008513 424382257 252917538 ... |
correct output |
---|
26 |
user output |
---|
24 |
Test 6
Verdict: TIME LIMIT EXCEEDED
input |
---|
2000 11 11 28 23 20 8 38 19 ... |
correct output |
---|
899400256 |
user output |
---|
(empty) |
Test 7
Verdict: TIME LIMIT EXCEEDED
input |
---|
2000 5824 6634 2357 5989 3916 7167 1590 8621 ... |
correct output |
---|
859795391 |
user output |
---|
(empty) |
Test 8
Verdict: TIME LIMIT EXCEEDED
input |
---|
2000 56581922 733372827 39593188 426830993 682173134 520740473 987750927 722901867 ... |
correct output |
---|
486845013 |
user output |
---|
(empty) |
Test 9
Verdict: TIME LIMIT EXCEEDED
input |
---|
2000 28 6 1 4 40 23 10 47 ... |
correct output |
---|
165607300 |
user output |
---|
(empty) |
Test 10
Verdict: TIME LIMIT EXCEEDED
input |
---|
2000 8794 6278 4397 5586 1035 6731 1762 4876 ... |
correct output |
---|
253752209 |
user output |
---|
(empty) |
Test 11
Verdict: TIME LIMIT EXCEEDED
input |
---|
2000 948965989 852232718 881018525 18261668 772863541 686843093 742994163 87761831 ... |
correct output |
---|
276095576 |
user output |
---|
(empty) |
Test 12
Verdict: TIME LIMIT EXCEEDED
input |
---|
2000 6 36 31 41 47 1 5 26 ... |
correct output |
---|
148272056 |
user output |
---|
(empty) |
Test 13
Verdict: TIME LIMIT EXCEEDED
input |
---|
2000 4887 2111 5131 5408 3556 9148 1003 4960 ... |
correct output |
---|
236890539 |
user output |
---|
(empty) |
Test 14
Verdict: TIME LIMIT EXCEEDED
input |
---|
2000 49893675 80663652 941984944 20376205 555187967 29137199 711849004 263600143 ... |
correct output |
---|
120470326 |
user output |
---|
(empty) |
Test 15
Verdict: TIME LIMIT EXCEEDED
input |
---|
2000 28 16 32 34 5 25 4 46 ... |
correct output |
---|
376546654 |
user output |
---|
(empty) |
Test 16
Verdict: TIME LIMIT EXCEEDED
input |
---|
2000 3088 5810 8864 6628 9055 4581 5867 9640 ... |
correct output |
---|
432666194 |
user output |
---|
(empty) |
Test 17
Verdict: TIME LIMIT EXCEEDED
input |
---|
2000 520019616 510530387 746987957 875964804 919415581 235520177 519337093 502471724 ... |
correct output |
---|
97391443 |
user output |
---|
(empty) |
Test 18
Verdict: TIME LIMIT EXCEEDED
input |
---|
2000 20 22 17 6 49 37 25 8 ... |
correct output |
---|
671526087 |
user output |
---|
(empty) |
Test 19
Verdict: TIME LIMIT EXCEEDED
input |
---|
2000 2061 4245 561 7256 4676 6364 6083 9061 ... |
correct output |
---|
375967348 |
user output |
---|
(empty) |
Test 20
Verdict: TIME LIMIT EXCEEDED
input |
---|
2000 177031673 242710396 945694890 566220213 13679095 730681457 510486169 714683946 ... |
correct output |
---|
607190203 |
user output |
---|
(empty) |