QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#110267#3017. Missing Gnomescheems_is_hiringTL 173ms3912kbC++202.1kb2023-06-01 11:31:022023-06-01 11:31:05

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-06-01 11:31:05]
  • 评测
  • 测评结果:TL
  • 用时:173ms
  • 内存:3912kb
  • [2023-06-01 11:31:02]
  • 提交

answer



#include <iostream>
#include <bits/stdc++.h>

using namespace std;

#define ll                  long long int
#define ii                  pair<int,int>
#define pb                  push_back
#define all(a)              (a).begin(), (a).end()
#define FOR(i, l, r)        for(int i = l; i < r ; i ++)
#define seeList(A)          if(debug) { bool leonelCheems = 0; cerr << "[ ";  for(auto x : A) { if(!leonelCheems) cerr << x , leonelCheems = 1; else cerr << " , " << x ;} cerr << " ]" << endl; }
#define seeVar(A)           if(debug) { cerr << "{ " << A << " }" << endl; }
#define executeTime         cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";

const int    N       =      2e5  + 9;
const int    mod     =      1e9  + 7;
const int    inf     =      2e9  + 9;
const ll     modL    =      1e9  + 7;
const ll     infL    =      2e18 + 9;
const double pi      =      acos(-1);

// si no vas por todo, anda pa ashá bobo
// mirame a la cara, lo siento pero te como hermano * bailecito *

bool debug = { 1 };
bitset<N> marked;

void cumbia420PaLosNegros(int testCase) { /* aguante la falopa wacho y la gente de la cashe :v */
    int n, k; cin >> n >> k;
    queue<int> A, B;

    FOR(i, 0, k) {
        int x; cin >> x;
        marked[x] = 1;
        A.push(x);
    }

    FOR(i, 1, n + 1) {
		if(!marked[i]) B.push(i);
	}

    //seeList(S);
	int it = 0;
    while(A.size() || B.size()) {
		it ++;
        if(A.empty()) {
			while(!B.empty()) {
				cout << B.front() << endl;
				B.pop();
			}
			return;
        }
        else if(B.empty()) {
            while(!A.empty()) {
				cout << A.front() << endl;
				A.pop();
			}
			return;
        }
        else {
            if(A.front() < B.front()) {
                cout << A.front() << endl;  A.pop();
            }
            else {
                cout << B.front() << endl; 	B.pop();
            }
        }
    }
	assert(it <= n + 1);
}

int main() {
	cin.tie(0); ios_base::sync_with_stdio(0);
	cerr << "! ready " << endl;
	int t = 1;
	//cin >> t;
	FOR(i, 1, t + 1) cumbia420PaLosNegros(i);
	executeTime
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 2ms
memory: 3764kb

input:

5 3
1
4
2

output:

1
3
4
2
5

result:

ok 5 number(s): "1 3 4 2 5"

Test #2:

score: 0
Accepted
time: 3ms
memory: 3852kb

input:

7 4
6
4
2
1

output:

3
5
6
4
2
1
7

result:

ok 7 numbers

Test #3:

score: 0
Accepted
time: 3ms
memory: 3768kb

input:

1 1
1

output:

1

result:

ok 1 number(s): "1"

Test #4:

score: 0
Accepted
time: 141ms
memory: 3836kb

input:

100000 1
1

output:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
...

result:

ok 100000 numbers

Test #5:

score: 0
Accepted
time: 173ms
memory: 3912kb

input:

100000 1
50000

output:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
...

result:

ok 100000 numbers

Test #6:

score: -100
Time Limit Exceeded

input:

100000 1
100000

output:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
...

result: