QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#882112#9182. Infinite RaceI_love_Riley_Andersen#29 24ms3584kbC++111.9kb2025-02-04 21:09:322025-02-04 21:09:34

Judging History

This is the latest submission verdict.

  • [2025-02-04 21:09:34]
  • Judged
  • Verdict: 29
  • Time: 24ms
  • Memory: 3584kb
  • [2025-02-04 21:09:32]
  • Submitted

answer

#include"bits/stdc++.h"
#include"ext/pb_ds/tree_policy.hpp"
#include"ext/pb_ds/assoc_container.hpp"
using namespace std;
using namespace __gnu_pbds;
#define FOR(i,a,b)for(int i=a;i<b;i++)
#define F0R(i,a)FOR(i,0,a)
#define ROF(i,a,b)for(int i=b-1;a<=i;i--)
#define R0F(i,a)ROF(i,0,a)
#define rep(a)F0R(_,a)
#define each(a,x)for(auto&a:x)
#define all(a)begin(a),end(a)
#define sz(x)int(size(x))
#define lla(x)rbegin(x),rend(x)
#define SUM(a)accumulate(all(a),0ll)
#define SUMM(a,b)accumulate(a,a+b,0ll)
#define MAX(a)*max_element(all(a))
#define MAXX(a,b)*max_element(a,a+b)
#define MIN(a)*min_element(all(a))
#define MINN(a,b)*min_element(a,a+b)
#define con const int
#define lwb lower_bound
#define upb upper_bound
#define bry binary_search
#ifdef LOCAL
#define print(x)cout<<x;
#else
#define print(...)
#endif
#define debug(x)print(#x<<" = "<<x<<endl)
using ld=long double;
using ll=long long;
using str=string;
template<class T>using oset=tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;
template<class T>using omset=tree<T,null_type,less_equal<T>,rb_tree_tag,tree_order_statistics_node_update>;
template<class T>T minn(T a){return a;}
template<class T,class...Args>T minn(T a,Args... args){return min(a,minn(args...));}
template<class T>T maxx(T a){return a;}
template<class T,class...Args>T maxx(T a,Args... args){return max(a,maxx(args...));}
#define SMIN(a,b...)a=min(a,minn(b))
#define SMAX(a,b...)a=max(a,maxx(b))
void fileset(str a){assert(nullptr!=freopen((a+".in").c_str(),"r",stdin)&&nullptr!=freopen((a+".out").c_str(),"w",stdout));}
int main(){
    int N, Q;
    cin >> N >> Q;

    int ans = 0;
    int oth = 0;

    int last = 0;

    rep (Q){
        int X;
        cin >> X;

        if (X == last){
            if (1 == X) ans ++;
            else oth ++;
        } else {
            last = X;
        }
    }

    cout << ans << endl;
}

詳細信息

Subtask #1:

score: 29
Accepted

Test #1:

score: 29
Accepted
time: 0ms
memory: 3584kb

input:

2
1
1

output:

0

result:

ok single line: '0'

Test #2:

score: 29
Accepted
time: 0ms
memory: 3584kb

input:

2
2
1
-1

output:

0

result:

ok single line: '0'

Test #3:

score: 29
Accepted
time: 1ms
memory: 3584kb

input:

2
5
-1
-1
-1
-1
1

output:

0

result:

ok single line: '0'

Test #4:

score: 29
Accepted
time: 23ms
memory: 3584kb

input:

2
200000
1
1
-1
-1
-1
1
-1
1
1
1
-1
-1
1
-1
1
1
-1
1
1
-1
-1
1
-1
-1
1
-1
1
-1
1
1
1
1
-1
1
-1
-1
-1
-1
-1
1
1
-1
-1
1
-1
-1
1
1
1
-1
-1
-1
-1
-1
1
-1
-1
1
1
1
-1
1
-1
-1
1
-1
-1
1
1
-1
-1
-1
1
-1
-1
1
-1
-1
-1
1
-1
1
-1
1
-1
-1
1
-1
1
1
-1
1
-1
1
-1
1
-1
1
-1
-1
-1
-1
-1
1
-1
-1
1
1
1
1
1
1
-1
-1
-...

output:

50154

result:

ok single line: '50154'

Test #5:

score: 29
Accepted
time: 22ms
memory: 3584kb

input:

2
200000
1
-1
1
-1
1
1
-1
1
-1
-1
1
-1
1
1
1
1
-1
-1
1
1
1
1
-1
1
-1
1
1
1
-1
-1
1
-1
-1
-1
1
1
1
1
-1
1
1
1
-1
1
1
1
-1
1
1
1
-1
1
1
1
1
1
1
1
-1
-1
1
1
-1
-1
-1
1
-1
-1
-1
-1
-1
1
-1
-1
-1
-1
1
1
1
1
-1
-1
-1
1
-1
-1
-1
-1
1
-1
-1
1
-1
1
1
-1
-1
-1
1
-1
-1
-1
-1
-1
-1
1
1
-1
-1
-1
1
-1
1
1
-1
-1
1...

output:

50172

result:

ok single line: '50172'

Test #6:

score: 29
Accepted
time: 24ms
memory: 3456kb

input:

2
200000
1
1
1
1
1
1
1
1
-1
1
1
1
1
-1
-1
-1
-1
1
-1
-1
1
-1
-1
-1
1
1
1
-1
1
1
-1
1
-1
1
-1
1
-1
-1
1
1
1
1
1
-1
1
1
1
-1
-1
-1
1
-1
1
1
-1
-1
1
-1
1
1
-1
1
-1
-1
-1
1
-1
-1
1
1
-1
-1
1
1
1
-1
-1
-1
-1
1
-1
-1
1
-1
-1
1
1
-1
-1
-1
1
-1
1
1
1
-1
1
1
1
1
-1
1
-1
-1
-1
1
1
1
-1
-1
1
1
-1
1
-1
-1
-1
1
...

output:

49713

result:

ok single line: '49713'

Test #7:

score: 29
Accepted
time: 24ms
memory: 3584kb

input:

2
200000
1
-1
-1
1
-1
1
-1
1
1
-1
1
-1
-1
-1
-1
-1
-1
-1
1
1
-1
1
-1
-1
-1
1
1
1
-1
1
1
-1
1
1
-1
1
-1
1
1
1
1
-1
-1
1
-1
-1
1
1
1
1
-1
-1
1
-1
-1
1
1
-1
1
-1
1
1
1
-1
-1
-1
-1
-1
1
1
-1
-1
1
1
1
1
-1
-1
1
1
-1
-1
-1
-1
1
-1
-1
-1
1
1
1
-1
1
1
-1
1
1
1
-1
1
-1
-1
-1
1
1
-1
1
1
1
-1
1
1
1
1
1
-1
-1
1...

output:

49564

result:

ok single line: '49564'

Test #8:

score: 29
Accepted
time: 0ms
memory: 3584kb

input:

2
100
-1
1
-1
1
-1
-1
-1
-1
1
-1
-1
-1
1
-1
-1
-1
1
-1
-1
1
1
1
1
1
1
1
-1
-1
1
-1
-1
1
-1
-1
1
1
-1
-1
-1
-1
1
-1
1
-1
-1
1
1
-1
-1
1
-1
-1
-1
-1
1
-1
-1
1
1
-1
-1
1
-1
-1
1
1
-1
-1
1
-1
-1
1
1
-1
-1
-1
1
-1
-1
-1
-1
-1
1
1
1
-1
1
1
1
-1
1
-1
1
1
-1
1
-1
-1
-1
-1

output:

16

result:

ok single line: '16'

Test #9:

score: 29
Accepted
time: 0ms
memory: 3584kb

input:

2
2
1
1

output:

1

result:

ok single line: '1'

Test #10:

score: 29
Accepted
time: 19ms
memory: 3584kb

input:

2
200000
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1...

output:

199999

result:

ok single line: '199999'

Test #11:

score: 29
Accepted
time: 0ms
memory: 3584kb

input:

2
100
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1

output:

99

result:

ok single line: '99'

Test #12:

score: 29
Accepted
time: 22ms
memory: 3584kb

input:

2
200000
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-...

output:

0

result:

ok single line: '0'

Test #13:

score: 29
Accepted
time: 0ms
memory: 3584kb

input:

2
100
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1

output:

0

result:

ok single line: '0'

Test #14:

score: 29
Accepted
time: 23ms
memory: 3584kb

input:

2
200000
1
1
1
1
1
1
1
1
1
-1
1
1
-1
-1
-1
1
1
1
-1
1
-1
1
-1
-1
-1
1
-1
1
1
-1
-1
-1
-1
1
1
1
-1
-1
1
-1
1
1
1
1
1
1
-1
1
-1
1
1
-1
-1
-1
1
1
-1
1
1
-1
-1
-1
-1
-1
-1
-1
1
-1
1
1
1
1
1
1
-1
1
-1
-1
-1
1
-1
1
-1
-1
1
1
-1
1
-1
1
1
-1
-1
1
1
1
-1
-1
-1
1
-1
-1
-1
-1
1
1
1
-1
1
1
-1
-1
1
1
-1
-1
1
1
1...

output:

50402

result:

ok single line: '50402'

Test #15:

score: 29
Accepted
time: 0ms
memory: 3584kb

input:

2
100
1
1
1
-1
1
1
1
-1
-1
-1
-1
1
-1
1
1
1
-1
-1
1
1
-1
-1
-1
-1
-1
1
-1
1
-1
-1
1
-1
1
1
1
-1
-1
-1
1
1
1
1
1
1
-1
1
1
-1
-1
-1
-1
1
-1
-1
-1
1
-1
-1
1
-1
-1
-1
-1
1
1
1
-1
1
1
-1
-1
1
1
1
1
-1
-1
-1
1
1
1
1
1
-1
1
-1
-1
-1
1
1
-1
1
-1
-1
-1
1
-1
-1
1
1

output:

27

result:

ok single line: '27'

Test #16:

score: 29
Accepted
time: 24ms
memory: 3584kb

input:

2
200000
1
-1
1
-1
-1
-1
1
1
1
1
1
1
-1
-1
1
1
1
-1
1
1
1
-1
1
-1
1
1
1
1
-1
-1
1
-1
1
-1
-1
1
1
1
1
1
1
-1
-1
1
-1
1
-1
-1
1
-1
1
-1
1
1
-1
-1
1
-1
1
-1
1
1
-1
1
1
1
1
1
1
-1
-1
-1
-1
1
-1
1
1
-1
1
-1
-1
1
-1
-1
-1
-1
1
1
1
-1
-1
1
-1
-1
-1
1
1
-1
1
-1
-1
-1
-1
1
1
-1
1
-1
1
-1
-1
-1
1
-1
-1
-1
1
1...

output:

49885

result:

ok single line: '49885'

Test #17:

score: 29
Accepted
time: 1ms
memory: 3584kb

input:

2
100
1
1
1
1
-1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
-1
1
1
1
1
1
1
-1
-1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
-1
1
1
1
1
-1
1
-1
1
1
1
1
1
1
-1
1
1
1
1
1
1
1
1
1
1
1
1
1
1

output:

84

result:

ok single line: '84'

Test #18:

score: 29
Accepted
time: 18ms
memory: 3584kb

input:

2
200000
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1...

output:

199987

result:

ok single line: '199987'

Test #19:

score: 29
Accepted
time: 0ms
memory: 3584kb

input:

2
4
1
1
1
1

output:

3

result:

ok single line: '3'

Test #20:

score: 29
Accepted
time: 0ms
memory: 3584kb

input:

2
5
1
-1
1
-1
-1

output:

0

result:

ok single line: '0'

Subtask #2:

score: 0
Wrong Answer

Test #21:

score: 34
Accepted
time: 0ms
memory: 3584kb

input:

2
2
1
1

output:

1

result:

ok single line: '1'

Test #22:

score: 34
Accepted
time: 17ms
memory: 3584kb

input:

2
200000
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1...

output:

199999

result:

ok single line: '199999'

Test #23:

score: 34
Accepted
time: 0ms
memory: 3456kb

input:

2
100
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1

output:

99

result:

ok single line: '99'

Test #24:

score: 0
Wrong Answer
time: 0ms
memory: 3584kb

input:

100
100
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
1

output:

0

result:

wrong answer 1st lines differ - expected: '1', found: '0'

Subtask #3:

score: 0
Wrong Answer

Test #45:

score: 22
Accepted
time: 1ms
memory: 3456kb

input:

2
1
1

output:

0

result:

ok single line: '0'

Test #46:

score: 22
Accepted
time: 0ms
memory: 3584kb

input:

2
2
1
-1

output:

0

result:

ok single line: '0'

Test #47:

score: 22
Accepted
time: 0ms
memory: 3584kb

input:

2
5
-1
-1
-1
-1
1

output:

0

result:

ok single line: '0'

Test #48:

score: 22
Accepted
time: 0ms
memory: 3584kb

input:

2
100
-1
1
-1
1
-1
-1
-1
-1
1
-1
-1
-1
1
-1
-1
-1
1
-1
-1
1
1
1
1
1
1
1
-1
-1
1
-1
-1
1
-1
-1
1
1
-1
-1
-1
-1
1
-1
1
-1
-1
1
1
-1
-1
1
-1
-1
-1
-1
1
-1
-1
1
1
-1
-1
1
-1
-1
1
1
-1
-1
1
-1
-1
1
1
-1
-1
-1
1
-1
-1
-1
-1
-1
1
1
1
-1
1
1
1
-1
1
-1
1
1
-1
1
-1
-1
-1
-1

output:

16

result:

ok single line: '16'

Test #49:

score: 22
Accepted
time: 0ms
memory: 3584kb

input:

2
2
1
1

output:

1

result:

ok single line: '1'

Test #50:

score: 22
Accepted
time: 0ms
memory: 3584kb

input:

2
100
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1

output:

99

result:

ok single line: '99'

Test #51:

score: 22
Accepted
time: 0ms
memory: 3584kb

input:

2
100
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1
-1
1

output:

0

result:

ok single line: '0'

Test #52:

score: 22
Accepted
time: 0ms
memory: 3584kb

input:

2
100
1
1
1
-1
1
1
1
-1
-1
-1
-1
1
-1
1
1
1
-1
-1
1
1
-1
-1
-1
-1
-1
1
-1
1
-1
-1
1
-1
1
1
1
-1
-1
-1
1
1
1
1
1
1
-1
1
1
-1
-1
-1
-1
1
-1
-1
-1
1
-1
-1
1
-1
-1
-1
-1
1
1
1
-1
1
1
-1
-1
1
1
1
1
-1
-1
-1
1
1
1
1
1
-1
1
-1
-1
-1
1
1
-1
1
-1
-1
-1
1
-1
-1
1
1

output:

27

result:

ok single line: '27'

Test #53:

score: 22
Accepted
time: 0ms
memory: 3584kb

input:

2
100
1
1
1
1
-1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
-1
1
1
1
1
1
1
-1
-1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
-1
1
1
1
1
-1
1
-1
1
1
1
1
1
1
-1
1
1
1
1
1
1
1
1
1
1
1
1
1
1

output:

84

result:

ok single line: '84'

Test #54:

score: 0
Wrong Answer
time: 0ms
memory: 3584kb

input:

100
100
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
1

output:

0

result:

wrong answer 1st lines differ - expected: '1', found: '0'

Subtask #4:

score: 0
Skipped

Dependency #1:

100%
Accepted

Dependency #2:

0%