Submission #143293

# Submission time Handle Problem Language Result Execution time Memory
143293 2019-08-13T14:22:25 Z mat_v Arranging Shoes (IOI19_shoes) C++14
10 / 100
1000 ms 18424 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 ind = 0;
        if(s[l] < 0)ind = 1;
        int gde = tike[koji][ind][dokle[koji][ind]];
        while(gde > l+1){
            //cout << gde << endl;
            swap(s[gde], s[gde-1]);
            res++;
            gde--;
        }
        dokle[koji][ind]++;
        dokle[koji][(ind+1)%2]++;
        if(!ind)res++;
        l += 2;
    }
    return res;
}
# Verdict Execution time Memory Grader output
1 Correct 11 ms 9724 KB Output is correct
2 Correct 10 ms 9720 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 11 ms 9724 KB Output is correct
2 Correct 10 ms 9720 KB Output is correct
3 Correct 10 ms 9720 KB Output is correct
4 Correct 11 ms 9720 KB Output is correct
5 Correct 10 ms 9656 KB Output is correct
6 Correct 10 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 11 ms 9720 KB Output is correct
10 Correct 11 ms 9848 KB Output is correct
11 Correct 11 ms 9720 KB Output is correct
12 Incorrect 11 ms 9720 KB Output isn't correct
13 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 11 ms 9724 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 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 11 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 11 ms 9720 KB Output is correct
13 Correct 11 ms 9720 KB Output is correct
14 Correct 10 ms 9720 KB Output is correct
15 Correct 17 ms 9720 KB Output is correct
16 Correct 13 ms 9720 KB Output is correct
17 Correct 9 ms 9720 KB Output is correct
18 Correct 11 ms 9720 KB Output is correct
19 Correct 11 ms 9744 KB Output is correct
20 Correct 15 ms 10104 KB Output is correct
21 Correct 17 ms 9976 KB Output is correct
22 Correct 54 ms 12192 KB Output is correct
23 Correct 41 ms 12420 KB Output is correct
24 Correct 47 ms 12276 KB Output is correct
25 Execution timed out 1061 ms 12404 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 11 ms 9720 KB Output is correct
3 Correct 10 ms 9720 KB Output is correct
4 Correct 13 ms 9720 KB Output is correct
5 Execution timed out 1068 ms 18424 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 11 ms 9724 KB Output is correct
2 Correct 10 ms 9720 KB Output is correct
3 Correct 10 ms 9720 KB Output is correct
4 Correct 11 ms 9720 KB Output is correct
5 Correct 10 ms 9656 KB Output is correct
6 Correct 10 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 11 ms 9720 KB Output is correct
10 Correct 11 ms 9848 KB Output is correct
11 Correct 11 ms 9720 KB Output is correct
12 Incorrect 11 ms 9720 KB Output isn't correct
13 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 11 ms 9724 KB Output is correct
2 Correct 10 ms 9720 KB Output is correct
3 Correct 10 ms 9720 KB Output is correct
4 Correct 11 ms 9720 KB Output is correct
5 Correct 10 ms 9656 KB Output is correct
6 Correct 10 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 11 ms 9720 KB Output is correct
10 Correct 11 ms 9848 KB Output is correct
11 Correct 11 ms 9720 KB Output is correct
12 Incorrect 11 ms 9720 KB Output isn't correct
13 Halted 0 ms 0 KB -