#include<bits/stdc++.h>
#define mod 1000000007
#define inf 100000000000000000
using namespace std;
unordered_map<int , unordered_map<int , int> >ist;
vector<vector<int> >num;
priority_queue<vector<int> >q;
vector<int>erg;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int menge , numm , nummer , que;
cin >> menge >> que;
for(int i = 0 ; i < menge ; i++){
cin >> numm >> nummer;
ist[numm][nummer] = i + 1;
num.push_back({numm , nummer , i + 1});
}
sort(num.begin() , num.end());
ist[num[num.size() - 1][0]][num[num.size() - 1][1]] = 0;
q.push(num[num.size() - 1]);
while(q.size()){
int x = q.top()[0] , y = q.top()[1] , z = q.top()[2];
// cout << z << "\n";
erg.push_back(z);
q.pop();
for(int i = -1 ; i <= 1 ; i++){
for(int j = -1 ; j <= 1 ; j++){
if(ist[x + i][y + j] > 0){
q.push({x + i , y + j , ist[x + i][y + j]});
ist[x + i][y + j] = 0;
}
}
}
}
if(erg.size() == menge){
cout << "YES\n";
for(int i = 0 ; i < erg.size() ; i++){
cout << erg[i] << "\n";
}
}
else{
cout << "NO\n";
}
}
Compilation message
skyscrapers.cpp: In function 'int main()':
skyscrapers.cpp:36:18: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
36 | if(erg.size() == menge){
| ~~~~~~~~~~~^~~~~~~~
skyscrapers.cpp:38:25: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
38 | for(int i = 0 ; i < erg.size() ; i++){
| ~~^~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
ans=YES N=1 |
2 |
Correct |
0 ms |
212 KB |
ans=YES N=4 |
3 |
Correct |
0 ms |
212 KB |
ans=NO N=4 |
4 |
Correct |
0 ms |
212 KB |
ans=YES N=5 |
5 |
Correct |
0 ms |
212 KB |
ans=YES N=9 |
6 |
Correct |
0 ms |
212 KB |
ans=YES N=5 |
7 |
Correct |
0 ms |
212 KB |
ans=NO N=9 |
8 |
Correct |
0 ms |
212 KB |
ans=NO N=10 |
9 |
Correct |
0 ms |
212 KB |
ans=YES N=10 |
10 |
Correct |
1 ms |
212 KB |
ans=YES N=10 |
11 |
Correct |
0 ms |
212 KB |
ans=YES N=10 |
12 |
Correct |
0 ms |
212 KB |
ans=YES N=9 |
13 |
Correct |
0 ms |
212 KB |
ans=YES N=9 |
14 |
Correct |
0 ms |
212 KB |
ans=YES N=8 |
15 |
Correct |
0 ms |
212 KB |
ans=YES N=8 |
16 |
Correct |
0 ms |
212 KB |
ans=NO N=2 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
ans=YES N=1 |
2 |
Correct |
0 ms |
212 KB |
ans=YES N=4 |
3 |
Correct |
0 ms |
212 KB |
ans=NO N=4 |
4 |
Correct |
0 ms |
212 KB |
ans=YES N=5 |
5 |
Correct |
0 ms |
212 KB |
ans=YES N=9 |
6 |
Correct |
0 ms |
212 KB |
ans=YES N=5 |
7 |
Correct |
0 ms |
212 KB |
ans=NO N=9 |
8 |
Correct |
0 ms |
212 KB |
ans=NO N=10 |
9 |
Correct |
0 ms |
212 KB |
ans=YES N=10 |
10 |
Correct |
1 ms |
212 KB |
ans=YES N=10 |
11 |
Correct |
0 ms |
212 KB |
ans=YES N=10 |
12 |
Correct |
0 ms |
212 KB |
ans=YES N=9 |
13 |
Correct |
0 ms |
212 KB |
ans=YES N=9 |
14 |
Correct |
0 ms |
212 KB |
ans=YES N=8 |
15 |
Correct |
0 ms |
212 KB |
ans=YES N=8 |
16 |
Correct |
0 ms |
212 KB |
ans=NO N=2 |
17 |
Correct |
0 ms |
212 KB |
ans=YES N=17 |
18 |
Correct |
0 ms |
212 KB |
ans=YES N=25 |
19 |
Correct |
1 ms |
340 KB |
ans=YES N=100 |
20 |
Correct |
1 ms |
340 KB |
ans=YES N=185 |
21 |
Correct |
1 ms |
320 KB |
ans=NO N=174 |
22 |
Correct |
1 ms |
340 KB |
ans=YES N=90 |
23 |
Correct |
1 ms |
212 KB |
ans=YES N=63 |
24 |
Correct |
1 ms |
212 KB |
ans=YES N=87 |
25 |
Correct |
1 ms |
340 KB |
ans=YES N=183 |
26 |
Correct |
1 ms |
340 KB |
ans=YES N=188 |
27 |
Correct |
1 ms |
340 KB |
ans=YES N=183 |
28 |
Correct |
1 ms |
340 KB |
ans=YES N=189 |
29 |
Correct |
1 ms |
340 KB |
ans=YES N=200 |
30 |
Correct |
1 ms |
340 KB |
ans=YES N=190 |
31 |
Correct |
1 ms |
340 KB |
ans=YES N=187 |
32 |
Correct |
1 ms |
340 KB |
ans=YES N=187 |
33 |
Correct |
1 ms |
340 KB |
ans=YES N=182 |
34 |
Correct |
1 ms |
340 KB |
ans=YES N=184 |
35 |
Correct |
1 ms |
340 KB |
ans=YES N=188 |
36 |
Correct |
1 ms |
340 KB |
ans=YES N=181 |
37 |
Correct |
1 ms |
340 KB |
ans=YES N=188 |
38 |
Correct |
1 ms |
316 KB |
ans=YES N=191 |
39 |
Correct |
1 ms |
340 KB |
ans=YES N=196 |
40 |
Correct |
1 ms |
324 KB |
ans=YES N=196 |
41 |
Correct |
1 ms |
320 KB |
ans=YES N=196 |
42 |
Correct |
1 ms |
340 KB |
ans=YES N=196 |
43 |
Correct |
1 ms |
252 KB |
ans=YES N=195 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
ans=YES N=1 |
2 |
Correct |
0 ms |
212 KB |
ans=YES N=4 |
3 |
Correct |
0 ms |
212 KB |
ans=NO N=4 |
4 |
Correct |
0 ms |
212 KB |
ans=YES N=5 |
5 |
Correct |
0 ms |
212 KB |
ans=YES N=9 |
6 |
Correct |
0 ms |
212 KB |
ans=YES N=5 |
7 |
Correct |
0 ms |
212 KB |
ans=NO N=9 |
8 |
Correct |
0 ms |
212 KB |
ans=NO N=10 |
9 |
Correct |
0 ms |
212 KB |
ans=YES N=10 |
10 |
Correct |
1 ms |
212 KB |
ans=YES N=10 |
11 |
Correct |
0 ms |
212 KB |
ans=YES N=10 |
12 |
Correct |
0 ms |
212 KB |
ans=YES N=9 |
13 |
Correct |
0 ms |
212 KB |
ans=YES N=9 |
14 |
Correct |
0 ms |
212 KB |
ans=YES N=8 |
15 |
Correct |
0 ms |
212 KB |
ans=YES N=8 |
16 |
Correct |
0 ms |
212 KB |
ans=NO N=2 |
17 |
Correct |
0 ms |
212 KB |
ans=YES N=17 |
18 |
Correct |
0 ms |
212 KB |
ans=YES N=25 |
19 |
Correct |
1 ms |
340 KB |
ans=YES N=100 |
20 |
Correct |
1 ms |
340 KB |
ans=YES N=185 |
21 |
Correct |
1 ms |
320 KB |
ans=NO N=174 |
22 |
Correct |
1 ms |
340 KB |
ans=YES N=90 |
23 |
Correct |
1 ms |
212 KB |
ans=YES N=63 |
24 |
Correct |
1 ms |
212 KB |
ans=YES N=87 |
25 |
Correct |
1 ms |
340 KB |
ans=YES N=183 |
26 |
Correct |
1 ms |
340 KB |
ans=YES N=188 |
27 |
Correct |
1 ms |
340 KB |
ans=YES N=183 |
28 |
Correct |
1 ms |
340 KB |
ans=YES N=189 |
29 |
Correct |
1 ms |
340 KB |
ans=YES N=200 |
30 |
Correct |
1 ms |
340 KB |
ans=YES N=190 |
31 |
Correct |
1 ms |
340 KB |
ans=YES N=187 |
32 |
Correct |
1 ms |
340 KB |
ans=YES N=187 |
33 |
Correct |
1 ms |
340 KB |
ans=YES N=182 |
34 |
Correct |
1 ms |
340 KB |
ans=YES N=184 |
35 |
Correct |
1 ms |
340 KB |
ans=YES N=188 |
36 |
Correct |
1 ms |
340 KB |
ans=YES N=181 |
37 |
Correct |
1 ms |
340 KB |
ans=YES N=188 |
38 |
Correct |
1 ms |
316 KB |
ans=YES N=191 |
39 |
Correct |
1 ms |
340 KB |
ans=YES N=196 |
40 |
Correct |
1 ms |
324 KB |
ans=YES N=196 |
41 |
Correct |
1 ms |
320 KB |
ans=YES N=196 |
42 |
Correct |
1 ms |
340 KB |
ans=YES N=196 |
43 |
Correct |
1 ms |
252 KB |
ans=YES N=195 |
44 |
Correct |
2 ms |
844 KB |
ans=NO N=1934 |
45 |
Correct |
2 ms |
468 KB |
ans=NO N=1965 |
46 |
Correct |
2 ms |
468 KB |
ans=YES N=1824 |
47 |
Correct |
2 ms |
468 KB |
ans=YES N=1981 |
48 |
Correct |
2 ms |
460 KB |
ans=YES N=1814 |
49 |
Correct |
2 ms |
596 KB |
ans=YES N=1854 |
50 |
Correct |
2 ms |
468 KB |
ans=YES N=1831 |
51 |
Correct |
3 ms |
544 KB |
ans=YES N=2000 |
52 |
Correct |
3 ms |
596 KB |
ans=YES N=1847 |
53 |
Correct |
3 ms |
596 KB |
ans=YES N=1819 |
54 |
Correct |
3 ms |
596 KB |
ans=YES N=1986 |
55 |
Correct |
3 ms |
724 KB |
ans=YES N=2000 |
56 |
Correct |
3 ms |
724 KB |
ans=YES N=1834 |
57 |
Correct |
3 ms |
724 KB |
ans=YES N=1860 |
58 |
Correct |
3 ms |
716 KB |
ans=YES N=1898 |
59 |
Correct |
3 ms |
596 KB |
ans=YES N=1832 |
60 |
Correct |
3 ms |
852 KB |
ans=YES N=1929 |
61 |
Correct |
2 ms |
596 KB |
ans=YES N=1919 |
62 |
Correct |
3 ms |
724 KB |
ans=YES N=1882 |
63 |
Correct |
4 ms |
852 KB |
ans=YES N=1922 |
64 |
Correct |
3 ms |
716 KB |
ans=YES N=1989 |
65 |
Correct |
4 ms |
588 KB |
ans=YES N=1978 |
66 |
Correct |
3 ms |
908 KB |
ans=YES N=1867 |
67 |
Correct |
3 ms |
724 KB |
ans=YES N=1942 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
852 KB |
ans=NO N=1934 |
2 |
Correct |
1 ms |
468 KB |
ans=NO N=1965 |
3 |
Incorrect |
2 ms |
468 KB |
Contestant's solution is not lexicographically largest at index 1824 (1813 vs 974) |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
ans=YES N=1 |
2 |
Correct |
0 ms |
212 KB |
ans=YES N=4 |
3 |
Correct |
0 ms |
212 KB |
ans=NO N=4 |
4 |
Correct |
0 ms |
212 KB |
ans=YES N=5 |
5 |
Correct |
0 ms |
212 KB |
ans=YES N=9 |
6 |
Correct |
0 ms |
212 KB |
ans=YES N=5 |
7 |
Correct |
0 ms |
212 KB |
ans=NO N=9 |
8 |
Correct |
0 ms |
212 KB |
ans=NO N=10 |
9 |
Correct |
0 ms |
212 KB |
ans=YES N=10 |
10 |
Correct |
1 ms |
212 KB |
ans=YES N=10 |
11 |
Correct |
0 ms |
212 KB |
ans=YES N=10 |
12 |
Correct |
0 ms |
212 KB |
ans=YES N=9 |
13 |
Correct |
0 ms |
212 KB |
ans=YES N=9 |
14 |
Correct |
0 ms |
212 KB |
ans=YES N=8 |
15 |
Correct |
0 ms |
212 KB |
ans=YES N=8 |
16 |
Correct |
0 ms |
212 KB |
ans=NO N=2 |
17 |
Correct |
0 ms |
212 KB |
ans=YES N=17 |
18 |
Correct |
0 ms |
212 KB |
ans=YES N=25 |
19 |
Correct |
1 ms |
340 KB |
ans=YES N=100 |
20 |
Correct |
1 ms |
340 KB |
ans=YES N=185 |
21 |
Correct |
1 ms |
320 KB |
ans=NO N=174 |
22 |
Correct |
1 ms |
340 KB |
ans=YES N=90 |
23 |
Correct |
1 ms |
212 KB |
ans=YES N=63 |
24 |
Correct |
1 ms |
212 KB |
ans=YES N=87 |
25 |
Correct |
1 ms |
340 KB |
ans=YES N=183 |
26 |
Correct |
1 ms |
340 KB |
ans=YES N=188 |
27 |
Correct |
1 ms |
340 KB |
ans=YES N=183 |
28 |
Correct |
1 ms |
340 KB |
ans=YES N=189 |
29 |
Correct |
1 ms |
340 KB |
ans=YES N=200 |
30 |
Correct |
1 ms |
340 KB |
ans=YES N=190 |
31 |
Correct |
1 ms |
340 KB |
ans=YES N=187 |
32 |
Correct |
1 ms |
340 KB |
ans=YES N=187 |
33 |
Correct |
1 ms |
340 KB |
ans=YES N=182 |
34 |
Correct |
1 ms |
340 KB |
ans=YES N=184 |
35 |
Correct |
1 ms |
340 KB |
ans=YES N=188 |
36 |
Correct |
1 ms |
340 KB |
ans=YES N=181 |
37 |
Correct |
1 ms |
340 KB |
ans=YES N=188 |
38 |
Correct |
1 ms |
316 KB |
ans=YES N=191 |
39 |
Correct |
1 ms |
340 KB |
ans=YES N=196 |
40 |
Correct |
1 ms |
324 KB |
ans=YES N=196 |
41 |
Correct |
1 ms |
320 KB |
ans=YES N=196 |
42 |
Correct |
1 ms |
340 KB |
ans=YES N=196 |
43 |
Correct |
1 ms |
252 KB |
ans=YES N=195 |
44 |
Correct |
2 ms |
844 KB |
ans=NO N=1934 |
45 |
Correct |
2 ms |
468 KB |
ans=NO N=1965 |
46 |
Correct |
2 ms |
468 KB |
ans=YES N=1824 |
47 |
Correct |
2 ms |
468 KB |
ans=YES N=1981 |
48 |
Correct |
2 ms |
460 KB |
ans=YES N=1814 |
49 |
Correct |
2 ms |
596 KB |
ans=YES N=1854 |
50 |
Correct |
2 ms |
468 KB |
ans=YES N=1831 |
51 |
Correct |
3 ms |
544 KB |
ans=YES N=2000 |
52 |
Correct |
3 ms |
596 KB |
ans=YES N=1847 |
53 |
Correct |
3 ms |
596 KB |
ans=YES N=1819 |
54 |
Correct |
3 ms |
596 KB |
ans=YES N=1986 |
55 |
Correct |
3 ms |
724 KB |
ans=YES N=2000 |
56 |
Correct |
3 ms |
724 KB |
ans=YES N=1834 |
57 |
Correct |
3 ms |
724 KB |
ans=YES N=1860 |
58 |
Correct |
3 ms |
716 KB |
ans=YES N=1898 |
59 |
Correct |
3 ms |
596 KB |
ans=YES N=1832 |
60 |
Correct |
3 ms |
852 KB |
ans=YES N=1929 |
61 |
Correct |
2 ms |
596 KB |
ans=YES N=1919 |
62 |
Correct |
3 ms |
724 KB |
ans=YES N=1882 |
63 |
Correct |
4 ms |
852 KB |
ans=YES N=1922 |
64 |
Correct |
3 ms |
716 KB |
ans=YES N=1989 |
65 |
Correct |
4 ms |
588 KB |
ans=YES N=1978 |
66 |
Correct |
3 ms |
908 KB |
ans=YES N=1867 |
67 |
Correct |
3 ms |
724 KB |
ans=YES N=1942 |
68 |
Correct |
83 ms |
9132 KB |
ans=NO N=66151 |
69 |
Correct |
44 ms |
7268 KB |
ans=NO N=64333 |
70 |
Correct |
103 ms |
9084 KB |
ans=YES N=69316 |
71 |
Correct |
73 ms |
8864 KB |
ans=YES N=66695 |
72 |
Correct |
88 ms |
8960 KB |
ans=YES N=68436 |
73 |
Correct |
82 ms |
9168 KB |
ans=YES N=70000 |
74 |
Correct |
83 ms |
8960 KB |
ans=YES N=68501 |
75 |
Correct |
86 ms |
9112 KB |
ans=YES N=70000 |
76 |
Correct |
74 ms |
8844 KB |
ans=YES N=65009 |
77 |
Correct |
95 ms |
12016 KB |
ans=YES N=67007 |
78 |
Correct |
103 ms |
13688 KB |
ans=YES N=66357 |
79 |
Correct |
115 ms |
14332 KB |
ans=YES N=65430 |
80 |
Correct |
103 ms |
14284 KB |
ans=YES N=65790 |
81 |
Correct |
105 ms |
13232 KB |
ans=YES N=66020 |
82 |
Correct |
98 ms |
12508 KB |
ans=YES N=65809 |
83 |
Correct |
86 ms |
10028 KB |
ans=YES N=65651 |
84 |
Correct |
131 ms |
17020 KB |
ans=YES N=68040 |
85 |
Correct |
113 ms |
15536 KB |
ans=YES N=66570 |
86 |
Correct |
67 ms |
8428 KB |
ans=YES N=65421 |
87 |
Correct |
89 ms |
9460 KB |
ans=YES N=68351 |
88 |
Correct |
73 ms |
8968 KB |
ans=YES N=67027 |
89 |
Correct |
83 ms |
11380 KB |
ans=YES N=68879 |
90 |
Correct |
79 ms |
9480 KB |
ans=YES N=67256 |
91 |
Correct |
246 ms |
18568 KB |
ans=YES N=148315 |
92 |
Correct |
121 ms |
17892 KB |
ans=NO N=142745 |
93 |
Correct |
263 ms |
44876 KB |
ans=NO N=148443 |
94 |
Correct |
209 ms |
19940 KB |
ans=YES N=148328 |
95 |
Correct |
216 ms |
20212 KB |
ans=YES N=147855 |
96 |
Correct |
224 ms |
20052 KB |
ans=YES N=150000 |
97 |
Correct |
202 ms |
19524 KB |
ans=YES N=144725 |
98 |
Correct |
234 ms |
20040 KB |
ans=YES N=149445 |
99 |
Correct |
216 ms |
19436 KB |
ans=YES N=144455 |
100 |
Correct |
219 ms |
19388 KB |
ans=YES N=143487 |
101 |
Correct |
230 ms |
20040 KB |
ans=YES N=149688 |
102 |
Correct |
266 ms |
27248 KB |
ans=YES N=141481 |
103 |
Correct |
371 ms |
36296 KB |
ans=YES N=147430 |
104 |
Correct |
266 ms |
23584 KB |
ans=YES N=142247 |
105 |
Correct |
288 ms |
26928 KB |
ans=YES N=149941 |
106 |
Correct |
375 ms |
35468 KB |
ans=YES N=141635 |
107 |
Correct |
291 ms |
30920 KB |
ans=YES N=142896 |
108 |
Correct |
295 ms |
34284 KB |
ans=YES N=142069 |
109 |
Correct |
239 ms |
20204 KB |
ans=YES N=142378 |
110 |
Correct |
313 ms |
29848 KB |
ans=YES N=150000 |
111 |
Correct |
324 ms |
38732 KB |
ans=YES N=141452 |
112 |
Correct |
317 ms |
39888 KB |
ans=YES N=134453 |
113 |
Correct |
372 ms |
56764 KB |
ans=YES N=144172 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
83 ms |
9204 KB |
ans=NO N=66151 |
2 |
Correct |
39 ms |
6780 KB |
ans=NO N=64333 |
3 |
Incorrect |
81 ms |
8436 KB |
Contestant's solution is not lexicographically largest at index 69316 (69235 vs 51180) |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
852 KB |
ans=NO N=1934 |
2 |
Correct |
1 ms |
468 KB |
ans=NO N=1965 |
3 |
Incorrect |
2 ms |
468 KB |
Contestant's solution is not lexicographically largest at index 1824 (1813 vs 974) |
4 |
Halted |
0 ms |
0 KB |
- |