Submission #143299

# Submission time Handle Problem Language Result Execution time Memory
143299 2019-08-13T14:40:11 Z mat_v Arranging Shoes (IOI19_shoes) C++14
50 / 100
1000 ms 17480 KB
#include <bits/stdc++.h>
#include <cstdio>
#include <cassert>
#define pb push_back

using namespace std;

int n;
vector<int> tike[200005][2];
int dokle[200005][2];
long long count_swaps(std::vector<int> s) {
    n = s.size()/2;
    for(int i=0; i<2*n; i++){
        if(s[i] < 0)tike[abs(s[i])][0].pb(i);
        else tike[s[i]][1].pb(i);
    }
    int l = 0;
    long long res = 0;
    while(l < 2*n){
        int koji = abs(s[l]);
        int pom = l+1;
        while(pom < 2*n){
            if(s[pom] == -s[l])break;
            pom++;
        }
        while(pom > l+1){
            swap(s[pom], s[pom - 1]);
            pom--;
            res++;
        }
        if(s[l] > 0)res++;
        l += 2;
    }
    return res;
}

Compilation message

shoes.cpp: In function 'long long int count_swaps(std::vector<int>)':
shoes.cpp:20:13: warning: unused variable 'koji' [-Wunused-variable]
         int koji = abs(s[l]);
             ^~~~
# Verdict Execution time Memory Grader output
1 Correct 11 ms 9720 KB Output is correct
2 Correct 11 ms 9720 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 11 ms 9720 KB Output is correct
2 Correct 11 ms 9720 KB Output is correct
3 Correct 10 ms 9720 KB Output is correct
4 Correct 10 ms 9720 KB Output is correct
5 Correct 11 ms 9720 KB Output is correct
6 Correct 11 ms 9720 KB Output is correct
7 Correct 10 ms 9720 KB Output is correct
8 Correct 10 ms 9720 KB Output is correct
9 Correct 10 ms 9720 KB Output is correct
10 Correct 10 ms 9720 KB Output is correct
11 Correct 11 ms 9720 KB Output is correct
12 Correct 10 ms 9720 KB Output is correct
13 Correct 11 ms 9720 KB Output is correct
14 Correct 11 ms 9724 KB Output is correct
15 Correct 13 ms 9720 KB Output is correct
16 Correct 12 ms 9720 KB Output is correct
17 Correct 12 ms 9720 KB Output is correct
18 Correct 12 ms 9720 KB Output is correct
19 Correct 11 ms 9720 KB Output is correct
20 Correct 10 ms 9720 KB Output is correct
21 Correct 11 ms 9848 KB Output is correct
22 Correct 10 ms 9720 KB Output is correct
23 Correct 10 ms 9720 KB Output is correct
24 Correct 10 ms 9720 KB Output is correct
25 Correct 10 ms 9720 KB Output is correct
26 Correct 12 ms 9720 KB Output is correct
27 Correct 13 ms 9720 KB Output is correct
28 Correct 10 ms 9720 KB Output is correct
29 Correct 13 ms 9720 KB Output is correct
30 Correct 13 ms 9720 KB Output is correct
31 Correct 11 ms 9744 KB Output is correct
32 Correct 11 ms 9692 KB Output is correct
33 Correct 12 ms 9720 KB Output is correct
34 Correct 10 ms 9720 KB Output is correct
35 Correct 11 ms 9720 KB Output is correct
36 Correct 11 ms 9720 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 11 ms 9720 KB Output is correct
2 Correct 11 ms 9720 KB Output is correct
3 Correct 11 ms 9720 KB Output is correct
4 Correct 11 ms 9720 KB Output is correct
5 Correct 11 ms 9720 KB Output is correct
6 Correct 11 ms 9720 KB Output is correct
7 Correct 11 ms 9592 KB Output is correct
8 Correct 10 ms 9720 KB Output is correct
9 Correct 11 ms 9720 KB Output is correct
10 Correct 10 ms 9720 KB Output is correct
11 Correct 10 ms 9720 KB Output is correct
12 Correct 11 ms 9768 KB Output is correct
13 Correct 11 ms 9692 KB Output is correct
14 Correct 13 ms 9720 KB Output is correct
15 Correct 10 ms 9720 KB Output is correct
16 Correct 11 ms 9848 KB Output is correct
17 Correct 11 ms 9720 KB Output is correct
18 Correct 11 ms 9720 KB Output is correct
19 Correct 13 ms 9720 KB Output is correct
20 Correct 15 ms 9976 KB Output is correct
21 Correct 15 ms 10104 KB Output is correct
22 Correct 60 ms 12192 KB Output is correct
23 Correct 39 ms 12396 KB Output is correct
24 Correct 47 ms 12276 KB Output is correct
25 Execution timed out 1087 ms 12400 KB Time limit exceeded
26 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 10 ms 9720 KB Output is correct
2 Correct 10 ms 9720 KB Output is correct
3 Correct 10 ms 9720 KB Output is correct
4 Correct 10 ms 9724 KB Output is correct
5 Execution timed out 1063 ms 17480 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 11 ms 9720 KB Output is correct
2 Correct 11 ms 9720 KB Output is correct
3 Correct 10 ms 9720 KB Output is correct
4 Correct 10 ms 9720 KB Output is correct
5 Correct 11 ms 9720 KB Output is correct
6 Correct 11 ms 9720 KB Output is correct
7 Correct 10 ms 9720 KB Output is correct
8 Correct 10 ms 9720 KB Output is correct
9 Correct 10 ms 9720 KB Output is correct
10 Correct 10 ms 9720 KB Output is correct
11 Correct 11 ms 9720 KB Output is correct
12 Correct 10 ms 9720 KB Output is correct
13 Correct 11 ms 9720 KB Output is correct
14 Correct 11 ms 9724 KB Output is correct
15 Correct 13 ms 9720 KB Output is correct
16 Correct 12 ms 9720 KB Output is correct
17 Correct 12 ms 9720 KB Output is correct
18 Correct 12 ms 9720 KB Output is correct
19 Correct 11 ms 9720 KB Output is correct
20 Correct 10 ms 9720 KB Output is correct
21 Correct 11 ms 9848 KB Output is correct
22 Correct 10 ms 9720 KB Output is correct
23 Correct 10 ms 9720 KB Output is correct
24 Correct 10 ms 9720 KB Output is correct
25 Correct 10 ms 9720 KB Output is correct
26 Correct 12 ms 9720 KB Output is correct
27 Correct 13 ms 9720 KB Output is correct
28 Correct 10 ms 9720 KB Output is correct
29 Correct 13 ms 9720 KB Output is correct
30 Correct 13 ms 9720 KB Output is correct
31 Correct 11 ms 9744 KB Output is correct
32 Correct 11 ms 9692 KB Output is correct
33 Correct 12 ms 9720 KB Output is correct
34 Correct 10 ms 9720 KB Output is correct
35 Correct 11 ms 9720 KB Output is correct
36 Correct 11 ms 9720 KB Output is correct
37 Correct 10 ms 9720 KB Output is correct
38 Correct 10 ms 9720 KB Output is correct
39 Correct 11 ms 9720 KB Output is correct
40 Correct 11 ms 9720 KB Output is correct
41 Correct 13 ms 9848 KB Output is correct
42 Correct 11 ms 9848 KB Output is correct
43 Correct 11 ms 9720 KB Output is correct
44 Correct 15 ms 9848 KB Output is correct
45 Correct 13 ms 9720 KB Output is correct
46 Correct 11 ms 9720 KB Output is correct
47 Correct 12 ms 9720 KB Output is correct
48 Correct 14 ms 9720 KB Output is correct
49 Correct 12 ms 9720 KB Output is correct
50 Correct 12 ms 9720 KB Output is correct
51 Correct 14 ms 9724 KB Output is correct
52 Correct 15 ms 9848 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 11 ms 9720 KB Output is correct
2 Correct 11 ms 9720 KB Output is correct
3 Correct 10 ms 9720 KB Output is correct
4 Correct 10 ms 9720 KB Output is correct
5 Correct 11 ms 9720 KB Output is correct
6 Correct 11 ms 9720 KB Output is correct
7 Correct 10 ms 9720 KB Output is correct
8 Correct 10 ms 9720 KB Output is correct
9 Correct 10 ms 9720 KB Output is correct
10 Correct 10 ms 9720 KB Output is correct
11 Correct 11 ms 9720 KB Output is correct
12 Correct 10 ms 9720 KB Output is correct
13 Correct 11 ms 9720 KB Output is correct
14 Correct 11 ms 9724 KB Output is correct
15 Correct 13 ms 9720 KB Output is correct
16 Correct 12 ms 9720 KB Output is correct
17 Correct 12 ms 9720 KB Output is correct
18 Correct 12 ms 9720 KB Output is correct
19 Correct 11 ms 9720 KB Output is correct
20 Correct 10 ms 9720 KB Output is correct
21 Correct 11 ms 9848 KB Output is correct
22 Correct 10 ms 9720 KB Output is correct
23 Correct 10 ms 9720 KB Output is correct
24 Correct 10 ms 9720 KB Output is correct
25 Correct 10 ms 9720 KB Output is correct
26 Correct 12 ms 9720 KB Output is correct
27 Correct 13 ms 9720 KB Output is correct
28 Correct 10 ms 9720 KB Output is correct
29 Correct 13 ms 9720 KB Output is correct
30 Correct 13 ms 9720 KB Output is correct
31 Correct 11 ms 9744 KB Output is correct
32 Correct 11 ms 9692 KB Output is correct
33 Correct 12 ms 9720 KB Output is correct
34 Correct 10 ms 9720 KB Output is correct
35 Correct 11 ms 9720 KB Output is correct
36 Correct 11 ms 9720 KB Output is correct
37 Correct 11 ms 9720 KB Output is correct
38 Correct 11 ms 9720 KB Output is correct
39 Correct 11 ms 9720 KB Output is correct
40 Correct 11 ms 9720 KB Output is correct
41 Correct 11 ms 9592 KB Output is correct
42 Correct 10 ms 9720 KB Output is correct
43 Correct 11 ms 9720 KB Output is correct
44 Correct 10 ms 9720 KB Output is correct
45 Correct 10 ms 9720 KB Output is correct
46 Correct 11 ms 9768 KB Output is correct
47 Correct 11 ms 9692 KB Output is correct
48 Correct 13 ms 9720 KB Output is correct
49 Correct 10 ms 9720 KB Output is correct
50 Correct 11 ms 9848 KB Output is correct
51 Correct 11 ms 9720 KB Output is correct
52 Correct 11 ms 9720 KB Output is correct
53 Correct 13 ms 9720 KB Output is correct
54 Correct 15 ms 9976 KB Output is correct
55 Correct 15 ms 10104 KB Output is correct
56 Correct 60 ms 12192 KB Output is correct
57 Correct 39 ms 12396 KB Output is correct
58 Correct 47 ms 12276 KB Output is correct
59 Execution timed out 1087 ms 12400 KB Time limit exceeded
60 Halted 0 ms 0 KB -