CSES - Aalto Competitive Programming 2024 - wk5 - Mon - Results
Submission details
Task:Pukkitappelu battle royale
Sender:aalto2024e_001
Submission time:2024-09-30 16:44:28 +0300
Language:C++ (C++11)
Status:READY
Result:ACCEPTED
Test results
testverdicttime
#1ACCEPTED0.00 sdetails
#2ACCEPTED0.00 sdetails
#3ACCEPTED0.00 sdetails
#4ACCEPTED0.00 sdetails
#5ACCEPTED0.00 sdetails
#6ACCEPTED0.00 sdetails
#7ACCEPTED0.00 sdetails
#8ACCEPTED0.00 sdetails
#9ACCEPTED0.00 sdetails
#10ACCEPTED0.00 sdetails
#11ACCEPTED0.00 sdetails
#12ACCEPTED0.00 sdetails
#13ACCEPTED0.00 sdetails
#14ACCEPTED0.00 sdetails
#15ACCEPTED0.00 sdetails
#16ACCEPTED0.00 sdetails
#17ACCEPTED0.00 sdetails
#18ACCEPTED0.00 sdetails
#19ACCEPTED0.00 sdetails
#20ACCEPTED0.00 sdetails
#21ACCEPTED0.00 sdetails
#22ACCEPTED0.00 sdetails
#23ACCEPTED0.00 sdetails
#24ACCEPTED0.00 sdetails
#25ACCEPTED0.00 sdetails
#26ACCEPTED0.00 sdetails
#27ACCEPTED0.00 sdetails
#28ACCEPTED0.00 sdetails
#29ACCEPTED0.00 sdetails
#30ACCEPTED0.00 sdetails
#31ACCEPTED0.00 sdetails
#32ACCEPTED0.00 sdetails
#33ACCEPTED0.00 sdetails
#34ACCEPTED0.00 sdetails
#35ACCEPTED0.00 sdetails
#36ACCEPTED0.00 sdetails
#37ACCEPTED0.00 sdetails
#38ACCEPTED0.00 sdetails
#39ACCEPTED0.00 sdetails
#40ACCEPTED0.00 sdetails
#41ACCEPTED0.00 sdetails
#42ACCEPTED0.00 sdetails
#43ACCEPTED0.00 sdetails
#44ACCEPTED0.00 sdetails
#45ACCEPTED0.00 sdetails
#46ACCEPTED0.00 sdetails
#47ACCEPTED0.00 sdetails
#48ACCEPTED0.00 sdetails
#49ACCEPTED0.00 sdetails
#50ACCEPTED0.00 sdetails
#51ACCEPTED0.00 sdetails
#52ACCEPTED0.00 sdetails
#53ACCEPTED0.00 sdetails
#54ACCEPTED0.00 sdetails
#55ACCEPTED0.00 sdetails
#56ACCEPTED0.00 sdetails
#57ACCEPTED0.00 sdetails
#58ACCEPTED0.00 sdetails
#59ACCEPTED0.00 sdetails
#60ACCEPTED0.00 sdetails
#61ACCEPTED0.00 sdetails
#62ACCEPTED0.00 sdetails
#63ACCEPTED0.00 sdetails
#64ACCEPTED0.00 sdetails
#65ACCEPTED0.00 sdetails
#66ACCEPTED0.00 sdetails
#67ACCEPTED0.00 sdetails
#68ACCEPTED0.00 sdetails
#69ACCEPTED0.00 sdetails
#70ACCEPTED0.00 sdetails
#71ACCEPTED0.00 sdetails
#72ACCEPTED0.00 sdetails
#73ACCEPTED0.00 sdetails
#74ACCEPTED0.00 sdetails
#75ACCEPTED0.00 sdetails
#76ACCEPTED0.00 sdetails
#77ACCEPTED0.00 sdetails
#78ACCEPTED0.00 sdetails
#79ACCEPTED0.00 sdetails
#80ACCEPTED0.02 sdetails
#81ACCEPTED0.03 sdetails
#82ACCEPTED0.02 sdetails
#83ACCEPTED0.02 sdetails
#84ACCEPTED0.02 sdetails
#85ACCEPTED0.02 sdetails
#86ACCEPTED0.02 sdetails
#87ACCEPTED0.02 sdetails
#88ACCEPTED0.02 sdetails
#89ACCEPTED0.01 sdetails

Code

#include <algorithm>
#include <bits/stdc++.h>
#include <string>
using namespace std;
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
#define int long long

string to_string(string s) {
    return '"' + s + '"';
}
 
string to_string(const char* s) {
    return to_string((string) s);
}
 
string to_string(bool b) {
    return (b ? "true" : "false");
}
 
template <typename A, typename B>
string to_string(pair<A, B> p) {
    return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
 
template <typename A>
string to_string(A v) {
    bool first = true;
    string res = "{";
    for (const auto &x : v) {
        if (!first) {
            res += ", ";
        }
        first = false;
        res += to_string(x);
    }
    res += "}";
    return res;
}
 
void debug_out() {
    cerr << endl;
}
 
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
    cerr << " " << to_string(H);
    debug_out(T...);
}
 
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

const int N = 1e5 + 5;

int n, x;
int a[N];

void solve() {
    cin >> n >> x;
    for (int i = 1; i <= n; i++) {
        cin >> a[i];
    }

    for (int i = n; i >= 2; i--) {
        if ((a[i] - a[i - 1] - 1) % 2 == 0) {
            cout << i << '\n';
            return;
        }
    }

    cout << 1 << '\n';
}

signed main() {
    cin.tie(0)->sync_with_stdio(0);
            
    int t = 1;
    // cin >> t;

    while (t--) {
        solve();
    }
}

Test details

Test 1

Verdict: ACCEPTED

input
1 14
10 

correct output
1

user output
1

Test 2

Verdict: ACCEPTED

input
2 10
1 2 

correct output
2

user output
2

Test 3

Verdict: ACCEPTED

input
2 7
3 5 

correct output
1

user output
1

Test 4

Verdict: ACCEPTED

input
2 13
4 12 

correct output
1

user output
1

Test 5

Verdict: ACCEPTED

input
2 12
6 10 

correct output
1

user output
1

Test 6

Verdict: ACCEPTED

input
2 6
3 6 

correct output
2

user output
2

Test 7

Verdict: ACCEPTED

input
2 19
6 15 

correct output
2

user output
2

Test 8

Verdict: ACCEPTED

input
2 16
2 14 

correct output
1

user output
1

Test 9

Verdict: ACCEPTED

input
2 20
11 13 

correct output
1

user output
1

Test 10

Verdict: ACCEPTED

input
2 17
7 15 

correct output
1

user output
1

Test 11

Verdict: ACCEPTED

input
2 18
7 18 

correct output
2

user output
2

Test 12

Verdict: ACCEPTED

input
3 8
1 6 8 

correct output
2

user output
2

Test 13

Verdict: ACCEPTED

input
3 20
11 13 15 

correct output
1

user output
1

Test 14

Verdict: ACCEPTED

input
3 8
3 6 8 

correct output
2

user output
2

Test 15

Verdict: ACCEPTED

input
3 14
5 8 10 

correct output
2

user output
2

Test 16

Verdict: ACCEPTED

input
3 3
1 2 3 

correct output
3

user output
3

Test 17

Verdict: ACCEPTED

input
3 7
1 6 7 

correct output
3

user output
3

Test 18

Verdict: ACCEPTED

input
3 12
3 10 11 

correct output
3

user output
3

Test 19

Verdict: ACCEPTED

input
3 3
1 2 3 

correct output
3

user output
3

Test 20

Verdict: ACCEPTED

input
3 3
1 2 3 

correct output
3

user output
3

Test 21

Verdict: ACCEPTED

input
3 15
1 4 5 

correct output
3

user output
3

Test 22

Verdict: ACCEPTED

input
3 10
6 8 9 

correct output
3

user output
3

Test 23

Verdict: ACCEPTED

input
3 13
8 9 12 

correct output
3

user output
3

Test 24

Verdict: ACCEPTED

input
4 20
2 8 13 14 

correct output
4

user output
4

Test 25

Verdict: ACCEPTED

input
4 20
12 13 14 18 

correct output
3

user output
3

Test 26

Verdict: ACCEPTED

input
4 13
2 4 12 13 

correct output
4

user output
4

Test 27

Verdict: ACCEPTED

input
4 13
1 3 7 13 

correct output
1

user output
1

Test 28

Verdict: ACCEPTED

input
4 16
5 7 8 15 

correct output
4

user output
4

Test 29

Verdict: ACCEPTED

input
4 11
7 8 10 11 

correct output
4

user output
4

Test 30

Verdict: ACCEPTED

input
5 13
6 8 10 11 12 

correct output
5

user output
5

Test 31

Verdict: ACCEPTED

input
5 11
1 2 4 8 11 

correct output
5

user output
5

Test 32

Verdict: ACCEPTED

input
5 11
1 3 5 7 11 

correct output
1

user output
1

Test 33

Verdict: ACCEPTED

input
5 13
1 2 4 10 11 

correct output
5

user output
5

Test 34

Verdict: ACCEPTED

input
5 20
4 11 18 19 20 

correct output
5

user output
5

Test 35

Verdict: ACCEPTED

input
5 8
1 2 3 7 8 

correct output
5

user output
5

Test 36

Verdict: ACCEPTED

input
5 19
2 4 7 16 19 

correct output
5

user output
5

Test 37

Verdict: ACCEPTED

input
5 6
2 3 4 5 6 

correct output
5

user output
5

Test 38

Verdict: ACCEPTED

input
5 18
1 5 7 16 18 

correct output
4

user output
4

Test 39

Verdict: ACCEPTED

input
5 5
1 2 3 4 5 

correct output
5

user output
5

Test 40

Verdict: ACCEPTED

input
10 16
1 5 7 8 9 10 11 12 14 15 

correct output
10

user output
10

Test 41

Verdict: ACCEPTED

input
10 14
1 2 3 4 5 6 8 10 11 14 

correct output
10

user output
10

Test 42

Verdict: ACCEPTED

input
10 14
1 2 3 5 6 7 8 9 10 14 

correct output
9

user output
9

Test 43

Verdict: ACCEPTED

input
10 16
1 2 3 5 7 9 10 12 14 15 

correct output
10

user output
10

Test 44

Verdict: ACCEPTED

input
10 20
4 5 11 12 13 14 15 18 19 20 

correct output
10

user output
10

Test 45

Verdict: ACCEPTED

input
10 12
1 2 3 5 6 7 8 10 11 12 

correct output
10

user output
10

Test 46

Verdict: ACCEPTED

input
10 19
1 2 3 4 7 8 11 12 16 19 

correct output
10

user output
10

Test 47

Verdict: ACCEPTED

input
10 10
1 2 3 4 5 6 7 8 9 10 

correct output
10

user output
10

Test 48

Verdict: ACCEPTED

input
10 19
1 5 8 9 11 12 15 16 17 19 

correct output
9

user output
9

Test 49

Verdict: ACCEPTED

input
10 10
1 2 3 4 5 6 7 8 9 10 

correct output
10

user output
10

Test 50

Verdict: ACCEPTED

input
100 589284111
11528796 12405338 23576564 347...

correct output
100

user output
100

Test 51

Verdict: ACCEPTED

input
100 447774061
54585 8727508 9242273 13069870...

correct output
98

user output
98

Test 52

Verdict: ACCEPTED

input
100 468146062
12372478 31155934 38008300 391...

correct output
99

user output
99

Test 53

Verdict: ACCEPTED

input
100 591414846
11503156 12648374 14184172 147...

correct output
94

user output
94

Test 54

Verdict: ACCEPTED

input
100 967035023
5539596 6689688 9648746 204276...

correct output
92

user output
92

Test 55

Verdict: ACCEPTED

input
100 238363452
391838 528333 1368439 3479103 ...

correct output
95

user output
95

Test 56

Verdict: ACCEPTED

input
100 958701382
44771412 58491554 63972355 689...

correct output
97

user output
97

Test 57

Verdict: ACCEPTED

input
100 81935503
1314125 2056565 5446047 595110...

correct output
100

user output
100

Test 58

Verdict: ACCEPTED

input
100 937837780
11934038 12239373 22850648 308...

correct output
100

user output
100

Test 59

Verdict: ACCEPTED

input
100 11139267
84150 148618 432268 440149 520...

correct output
100

user output
100

Test 60

Verdict: ACCEPTED

input
200 589284211
2880992 5740962 8327109 115287...

correct output
200

user output
200

Test 61

Verdict: ACCEPTED

input
200 447774161
54585 1369773 4298783 5568757 ...

correct output
199

user output
199

Test 62

Verdict: ACCEPTED

input
200 468146162
2645901 6212116 12193387 12372...

correct output
200

user output
200

Test 63

Verdict: ACCEPTED

input
200 591414946
11503156 12648374 13023409 141...

correct output
197

user output
197

Test 64

Verdict: ACCEPTED

input
200 967035123
3142409 4210032 5539596 668968...

correct output
200

user output
200

Test 65

Verdict: ACCEPTED

input
200 238363552
391838 528333 1368439 2951457 ...

correct output
200

user output
200

Test 66

Verdict: ACCEPTED

input
200 958701482
915344 26318971 39308105 44426...

correct output
200

user output
200

Test 67

Verdict: ACCEPTED

input
200 81935603
117854 1314125 2056565 3274591...

correct output
200

user output
200

Test 68

Verdict: ACCEPTED

input
200 937837880
798751 8921056 9526547 1193403...

correct output
200

user output
200

Test 69

Verdict: ACCEPTED

input
200 11139367
50914 81279 84150 90865 148618...

correct output
200

user output
200

Test 70

Verdict: ACCEPTED

input
1000 589285011
33962 2483784 2880992 4837424 ...

correct output
998

user output
998

Test 71

Verdict: ACCEPTED

input
1000 447774961
54585 191853 483557 1369773 14...

correct output
1000

user output
1000

Test 72

Verdict: ACCEPTED

input
1000 468146962
58977 735268 898440 1184659 12...

correct output
1000

user output
1000

Test 73

Verdict: ACCEPTED

input
1000 591415746
293786 457427 1304174 2617747 ...

correct output
995

user output
995

Test 74

Verdict: ACCEPTED

input
1000 967035923
838480 973536 1455856 3142409 ...

correct output
1000

user output
1000

Test 75

Verdict: ACCEPTED

input
1000 238364352
91364 391838 528333 959636 117...

correct output
998

user output
998

Test 76

Verdict: ACCEPTED

input
1000 958702282
557448 915344 2438616 2817236 ...

correct output
1000

user output
1000

Test 77

Verdict: ACCEPTED

input
1000 81936403
117854 134799 153186 216760 34...

correct output
999

user output
999

Test 78

Verdict: ACCEPTED

input
1000 937838680
798751 996213 1265361 2336515 ...

correct output
1000

user output
1000

Test 79

Verdict: ACCEPTED

input
1000 11140167
3811 29493 33378 46013 50914 5...

correct output
1000

user output
1000

Test 80

Verdict: ACCEPTED

input
100000 589384011
2462 12290 14854 19988 28400 3...

correct output
99996

user output
99996

Test 81

Verdict: ACCEPTED

input
100000 447873961
324 4948 5149 18319 22491 2468...

correct output
100000

user output
100000

Test 82

Verdict: ACCEPTED

input
100000 468245962
9543 11563 11899 20558 24392 2...

correct output
100000

user output
100000

Test 83

Verdict: ACCEPTED

input
100000 591514746
7688 9041 14326 23056 27308 28...

correct output
99998

user output
99998

Test 84

Verdict: ACCEPTED

input
100000 967134923
1024 2994 6645 24256 27426 329...

correct output
99997

user output
99997

Test 85

Verdict: ACCEPTED

input
100000 238463352
675 900 4012 15115 15476 22069...

correct output
100000

user output
100000

Test 86

Verdict: ACCEPTED

input
100000 958801282
7177 18494 20083 35163 36876 4...

correct output
99999

user output
99999

Test 87

Verdict: ACCEPTED

input
100000 82035403
237 539 626 1804 2747 3269 358...

correct output
100000

user output
100000

Test 88

Verdict: ACCEPTED

input
100000 937937680
1191 7701 13173 20679 24337 30...

correct output
100000

user output
100000

Test 89

Verdict: ACCEPTED

input
100000 11239167
70 124 318 547 595 692 784 880...

correct output
99999

user output
99999