| Task: | Distribution Center |
| Sender: | kh |
| Submission time: | 2017-03-09 15:32:21 +0200 |
| Language: | C++ |
| Status: | READY |
| Result: | 0 |
| group | verdict | score |
|---|---|---|
| #1 | WRONG ANSWER | 0 |
| test | verdict | time | |
|---|---|---|---|
| #1 | ACCEPTED | 0.03 s | details |
| #2 | ACCEPTED | 0.04 s | details |
| #3 | ACCEPTED | 0.03 s | details |
| #4 | ACCEPTED | 0.03 s | details |
| #5 | ACCEPTED | 0.04 s | details |
| #6 | ACCEPTED | 0.04 s | details |
| #7 | ACCEPTED | 0.04 s | details |
| #8 | ACCEPTED | 0.04 s | details |
| #9 | ACCEPTED | 0.03 s | details |
| #10 | ACCEPTED | 0.04 s | details |
| #11 | ACCEPTED | 0.03 s | details |
| #12 | ACCEPTED | 0.03 s | details |
| #13 | ACCEPTED | 0.11 s | details |
| #14 | ACCEPTED | 0.14 s | details |
| #15 | ACCEPTED | 0.04 s | details |
| #16 | WRONG ANSWER | 0.34 s | details |
| #17 | WRONG ANSWER | 0.30 s | details |
| #18 | WRONG ANSWER | 0.30 s | details |
| #19 | WRONG ANSWER | 0.30 s | details |
| #20 | WRONG ANSWER | 0.31 s | details |
| #21 | WRONG ANSWER | 0.29 s | details |
| #22 | WRONG ANSWER | 0.32 s | details |
| #23 | WRONG ANSWER | 0.29 s | details |
| #24 | WRONG ANSWER | 0.31 s | details |
| #25 | WRONG ANSWER | 0.33 s | details |
| #26 | ACCEPTED | 0.77 s | details |
| #27 | ACCEPTED | 0.77 s | details |
| #28 | ACCEPTED | 0.67 s | details |
| #29 | ACCEPTED | 0.60 s | details |
| #30 | ACCEPTED | 0.68 s | details |
| #31 | WRONG ANSWER | 0.40 s | details |
| #32 | WRONG ANSWER | 0.31 s | details |
| #33 | WRONG ANSWER | 0.33 s | details |
| #34 | WRONG ANSWER | 0.35 s | details |
| #35 | WRONG ANSWER | 0.34 s | details |
| #36 | TIME LIMIT EXCEEDED | -- | details |
| #37 | ACCEPTED | 0.03 s | details |
| #38 | ACCEPTED | 0.03 s | details |
Code
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
int n, m;
cin >> n >> m;
map<int, set<int> >p;
for (int i = 1; i<n; i++) {
set<int> s;
p[i] = s;
}
for (int i = 0; i<m; i++) {
int x, y;
cin >> x >> y;
p[y].insert(x);
}
for (int i = 1; i<=n; i++) {
int t = 1;
int y = i-1;
int x = 0;
set<int> s = p[y];
if (y > 0 && s.size() > 0) {
t++; //cout << "a ";
auto it = s.end();
it--;
//cout << *it << "k ";
while (true) {
x = *it;
//cout << x << "l ";
y--;
set<int> s = p[y];
if (y <= 0 || s.empty()) break;
it = s.lower_bound(x);
it--;
//cout << *it << " " << x << "h ";
//prev = *it;
if (*it > x || *it <= 0) break;
else t++; //cout << "b ";
}
}
y = i;
if (y < n) {
set<int> s = p[y];
if (s.size() > 0) {
t++; //cout << "c ";
auto it = s.end();
it--;
while (true) {
x = *it;
y++;
set<int> s = p[y];
if (y >= n || s.empty()) break;
it = s.lower_bound(x);
it--;
//cout << *it << " " << x << "d ";
if (*it > x || *it <= 0) break;
else t++; //cout << "e ";
}
}
}
cout << t << " ";
}
cout << "\n";
return 0;
}
Test details
Test 1
Verdict: ACCEPTED
| input |
|---|
| 4 3 1000 1 2000 2 3000 3 |
| correct output |
|---|
| 2 3 4 4 |
| user output |
|---|
| 2 3 4 4 |
Test 2
Verdict: ACCEPTED
| input |
|---|
| 4 3 1 1 3 2 2 3 |
| correct output |
|---|
| 2 4 4 2 |
| user output |
|---|
| 2 4 4 2 |
Test 3
Verdict: ACCEPTED
| input |
|---|
| 10 9 100 1 200 2 300 3 400 4 ... |
| correct output |
|---|
| 2 3 4 5 6 7 8 9 10 10 |
| user output |
|---|
| 2 3 4 5 6 7 8 9 10 10 |
Test 4
Verdict: ACCEPTED
| input |
|---|
| 10 9 100 9 200 8 300 7 400 6 ... |
| correct output |
|---|
| 10 10 9 8 7 6 5 4 3 2 |
| user output |
|---|
| 10 10 9 8 7 6 5 4 3 2 |
Test 5
Verdict: ACCEPTED
| input |
|---|
| 10 9 100 1 200 9 300 2 400 8 ... |
| correct output |
|---|
| 2 3 4 5 10 10 5 4 3 2 |
| user output |
|---|
| 2 3 4 5 10 10 5 4 3 2 |
Test 6
Verdict: ACCEPTED
| input |
|---|
| 10 9 100 5 200 4 300 6 400 3 ... |
| correct output |
|---|
| 6 6 5 4 3 3 4 5 6 6 |
| user output |
|---|
| 6 6 5 4 3 3 4 5 6 6 |
Test 7
Verdict: ACCEPTED
| input |
|---|
| 10 9 100 5 200 5 300 5 400 5 ... |
| correct output |
|---|
| 1 1 1 1 2 2 1 1 1 1 |
| user output |
|---|
| 1 1 1 1 2 2 1 1 1 1 |
Test 8
Verdict: ACCEPTED
| input |
|---|
| 10 9 100 3 200 7 300 3 400 7 ... |
| correct output |
|---|
| 1 1 2 2 1 1 2 2 1 1 |
| user output |
|---|
| 1 1 2 2 1 1 2 2 1 1 |
Test 9
Verdict: ACCEPTED
| input |
|---|
| 10 1 1 1 |
| correct output |
|---|
| 2 2 1 1 1 1 1 1 1 1 |
| user output |
|---|
| 2 2 1 1 1 1 1 1 1 1 |
Test 10
Verdict: ACCEPTED
| input |
|---|
| 10 1 99999 1 |
| correct output |
|---|
| 2 2 1 1 1 1 1 1 1 1 |
| user output |
|---|
| 2 2 1 1 1 1 1 1 1 1 |
Test 11
Verdict: ACCEPTED
| input |
|---|
| 10 1 99999 9 |
| correct output |
|---|
| 1 1 1 1 1 1 1 1 2 2 |
| user output |
|---|
| 1 1 1 1 1 1 1 1 2 2 |
Test 12
Verdict: ACCEPTED
| input |
|---|
| 10 1 99999 1 |
| correct output |
|---|
| 2 2 1 1 1 1 1 1 1 1 |
| user output |
|---|
| 2 2 1 1 1 1 1 1 1 1 |
Test 13
Verdict: ACCEPTED
| input |
|---|
| 100000 1 1 1 |
| correct output |
|---|
| 2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 ... |
| user output |
|---|
| 2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 ... |
Test 14
Verdict: ACCEPTED
| input |
|---|
| 100000 1 1 99999 |
| correct output |
|---|
| 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ... |
| user output |
|---|
| 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ... |
Test 15
Verdict: ACCEPTED
| input |
|---|
| 3 3 1 1 2 2 3 1 |
| correct output |
|---|
| 3 3 3 |
| user output |
|---|
| 3 3 3 |
Test 16
Verdict: WRONG ANSWER
| input |
|---|
| 100000 99999 51613 84082 3120 88303 90089 57457 82323 36322 ... |
| correct output |
|---|
| 2 3 3 1 2 2 1 2 2 1 2 3 3 2 2 ... |
| user output |
|---|
| 2 3 3 1 2 2 1 2 2 1 3 3 3 2 2 ... |
Test 17
Verdict: WRONG ANSWER
| input |
|---|
| 100000 99999 55166 92759 72522 49885 91041 58065 66993 66182 ... |
| correct output |
|---|
| 1 1 2 4 4 4 4 5 5 5 2 1 3 3 3 ... |
| user output |
|---|
| 1 1 3 4 4 5 5 5 5 5 3 1 3 3 3 ... |
Test 18
Verdict: WRONG ANSWER
| input |
|---|
| 100000 99999 90524 19551 22558 32618 68813 64252 16920 55138 ... |
| correct output |
|---|
| 2 3 3 3 3 2 2 2 3 3 3 5 5 5 1 ... |
| user output |
|---|
| 2 3 3 3 3 2 2 2 3 3 4 6 6 6 1 ... |
Test 19
Verdict: WRONG ANSWER
| input |
|---|
| 100000 99999 543 67313 25302 10820 96818 55943 93056 11560 ... |
| correct output |
|---|
| 1 1 2 2 2 2 3 3 3 1 3 3 4 4 2 ... |
| user output |
|---|
| 1 1 2 2 2 2 3 3 3 1 3 3 4 4 2 ... |
Test 20
Verdict: WRONG ANSWER
| input |
|---|
| 100000 99999 7098 91097 88439 4005 35386 17063 1917 86090 ... |
| correct output |
|---|
| 1 3 3 5 5 3 6 6 6 3 4 4 1 3 3 ... |
| user output |
|---|
| 1 3 3 6 6 4 6 6 6 3 4 4 1 3 3 ... |
Test 21
Verdict: WRONG ANSWER
| input |
|---|
| 100000 99999 61671 26653 41901 6290 45318 73847 46486 71566 ... |
| correct output |
|---|
| 2 2 2 2 2 4 4 2 2 4 4 4 4 5 5 ... |
| user output |
|---|
| 2 2 2 2 2 4 4 2 2 4 4 4 4 5 5 ... |
Test 22
Verdict: WRONG ANSWER
| input |
|---|
| 100000 99999 46666 39205 52562 49064 91772 40120 98068 12889 ... |
| correct output |
|---|
| 2 2 4 4 3 3 3 2 3 3 2 2 6 6 5 ... |
| user output |
|---|
| 2 2 4 4 3 3 3 3 3 3 2 2 6 6 5 ... |
Test 23
Verdict: WRONG ANSWER
| input |
|---|
| 100000 99999 53478 77769 62382 16090 33315 61136 81654 27389 ... |
| correct output |
|---|
| 1 1 1 1 4 4 3 4 4 3 3 3 3 4 4 ... |
| user output |
|---|
| 1 1 1 1 4 4 3 5 5 3 3 4 4 4 4 ... |
Test 24
Verdict: WRONG ANSWER
| input |
|---|
| 100000 99999 47015 74422 77958 41967 26483 37045 52560 21334 ... |
| correct output |
|---|
| 2 2 3 3 3 1 1 1 2 2 2 4 4 4 4 ... |
| user output |
|---|
| 2 2 3 3 3 1 1 1 2 2 2 4 4 4 4 ... |
Test 25
Verdict: WRONG ANSWER
| input |
|---|
| 100000 99999 30444 72197 95332 46416 50857 42241 79810 99621 ... |
| correct output |
|---|
| 1 1 2 2 2 4 4 4 4 6 6 2 3 3 3 ... |
| user output |
|---|
| 1 1 2 2 2 4 4 4 4 6 6 2 4 4 3 ... |
Test 26
Verdict: ACCEPTED
| input |
|---|
| 100 99999 15682 14 57251 20 83099 50 57485 33 ... |
| correct output |
|---|
| 100 100 100 100 100 100 100 10... |
| user output |
|---|
| 100 100 100 100 100 100 100 10... |
Test 27
Verdict: ACCEPTED
| input |
|---|
| 100 99999 77171 16 89815 40 18710 40 25372 60 ... |
| correct output |
|---|
| 100 100 100 100 100 100 100 10... |
| user output |
|---|
| 100 100 100 100 100 100 100 10... |
Test 28
Verdict: ACCEPTED
| input |
|---|
| 100 99999 69498 75 45431 25 35804 53 35830 44 ... |
| correct output |
|---|
| 100 100 100 100 100 100 100 10... |
| user output |
|---|
| 100 100 100 100 100 100 100 10... |
Test 29
Verdict: ACCEPTED
| input |
|---|
| 100 99999 14287 85 73750 52 14953 80 27802 96 ... |
| correct output |
|---|
| 100 100 100 100 100 100 100 10... |
| user output |
|---|
| 100 100 100 100 100 100 100 10... |
Test 30
Verdict: ACCEPTED
| input |
|---|
| 100 99999 60021 48 2240 89 45435 4 18160 44 ... |
| correct output |
|---|
| 100 100 100 100 100 100 100 10... |
| user output |
|---|
| 100 100 100 100 100 100 100 10... |
Test 31
Verdict: WRONG ANSWER
| input |
|---|
| 200000 99999 6459 28754 89524 100200 40972 165007 35542 79232 ... |
| correct output |
|---|
| 2 3 3 2 2 1 1 2 2 1 1 2 2 2 2 ... |
| user output |
|---|
| 2 3 3 2 2 1 1 2 2 1 1 2 2 2 2 ... |
Test 32
Verdict: WRONG ANSWER
| input |
|---|
| 200000 99999 91854 42500 34291 59129 21533 24543 12870 128293 ... |
| correct output |
|---|
| 1 2 2 2 2 2 2 1 1 2 2 2 2 2 2 ... |
| user output |
|---|
| 1 2 2 2 2 2 2 1 1 2 2 2 2 2 2 ... |
Test 33
Verdict: WRONG ANSWER
| input |
|---|
| 200000 99999 88029 49150 1821 18264 32450 150397 87753 44993 ... |
| correct output |
|---|
| 3 3 2 1 1 1 1 1 2 2 1 1 2 3 3 ... |
| user output |
|---|
| 3 3 3 1 1 1 1 1 2 2 1 1 2 3 3 ... |
Test 34
Verdict: WRONG ANSWER
| input |
|---|
| 200000 99999 18637 75106 91405 193095 10716 115503 78702 119750 ... |
| correct output |
|---|
| 1 2 2 1 1 1 1 2 2 1 3 3 2 1 1 ... |
| user output |
|---|
| 1 2 2 1 1 1 1 2 2 1 3 3 2 1 1 ... |
Test 35
Verdict: WRONG ANSWER
| input |
|---|
| 200000 99999 18742 152060 38942 104683 46001 85720 9675 93087 ... |
| correct output |
|---|
| 1 1 1 2 3 3 1 1 1 1 1 2 4 4 2 ... |
| user output |
|---|
| 1 1 1 3 3 3 1 1 1 1 1 2 4 4 2 ... |
Test 36
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 100000 99999 1 99999 2 99998 3 99997 4 99996 ... |
| correct output |
|---|
| 100000 100000 99999 99998 9999... |
| user output |
|---|
| (empty) |
Test 37
Verdict: ACCEPTED
| input |
|---|
| 4 3 1000 1 2000 2 3000 3 |
| correct output |
|---|
| 2 3 4 4 |
| user output |
|---|
| 2 3 4 4 |
Test 38
Verdict: ACCEPTED
| input |
|---|
| 4 3 1 1 3 2 2 3 |
| correct output |
|---|
| 2 4 4 2 |
| user output |
|---|
| 2 4 4 2 |
