Submission #143273

# Submission time Handle Problem Language Result Execution time Memory
143273 2019-08-13T13:39:49 Z mat_v Arranging Shoes (IOI19_shoes) C++14
10 / 100
1000 ms 13560 KB
#include "shoes.h"
#include <bits/stdc++.h>
#include <cstdio>
#include <cassert>
#define pb push_back

using namespace std;

int n;
vector<int> tike[100005][2];
int dokle[100005][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]++;
        if(!ind)res++;
        l += 2;
    }
    return res;
}
# Verdict Execution time Memory Grader output
1 Correct 6 ms 4984 KB Output is correct
2 Correct 6 ms 4956 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 4984 KB Output is correct
2 Correct 6 ms 4956 KB Output is correct
3 Correct 6 ms 4984 KB Output is correct
4 Correct 6 ms 4984 KB Output is correct
5 Correct 6 ms 4984 KB Output is correct
6 Correct 6 ms 4988 KB Output is correct
7 Correct 6 ms 4984 KB Output is correct
8 Correct 6 ms 4984 KB Output is correct
9 Correct 6 ms 4984 KB Output is correct
10 Correct 6 ms 4984 KB Output is correct
11 Correct 6 ms 4984 KB Output is correct
12 Incorrect 6 ms 4984 KB Output isn't correct
13 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 6 ms 4984 KB Output is correct
2 Correct 6 ms 4956 KB Output is correct
3 Correct 6 ms 4984 KB Output is correct
4 Correct 6 ms 4984 KB Output is correct
5 Correct 6 ms 4984 KB Output is correct
6 Correct 6 ms 4988 KB Output is correct
7 Correct 6 ms 4984 KB Output is correct
8 Correct 6 ms 4984 KB Output is correct
9 Correct 6 ms 4984 KB Output is correct
10 Correct 6 ms 4984 KB Output is correct
11 Correct 6 ms 4984 KB Output is correct
12 Correct 6 ms 4984 KB Output is correct
13 Correct 6 ms 4984 KB Output is correct
14 Correct 6 ms 4984 KB Output is correct
15 Correct 6 ms 4984 KB Output is correct
16 Correct 6 ms 4984 KB Output is correct
17 Correct 8 ms 4988 KB Output is correct
18 Correct 8 ms 4984 KB Output is correct
19 Correct 8 ms 4988 KB Output is correct
20 Correct 11 ms 5368 KB Output is correct
21 Correct 10 ms 5368 KB Output is correct
22 Correct 46 ms 7576 KB Output is correct
23 Correct 36 ms 7540 KB Output is correct
24 Correct 39 ms 7540 KB Output is correct
25 Execution timed out 1080 ms 7792 KB Time limit exceeded
26 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 6 ms 4984 KB Output is correct
2 Correct 6 ms 4984 KB Output is correct
3 Correct 6 ms 4984 KB Output is correct
4 Correct 6 ms 5112 KB Output is correct
5 Execution timed out 1076 ms 13560 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 6 ms 4984 KB Output is correct
2 Correct 6 ms 4956 KB Output is correct
3 Correct 6 ms 4984 KB Output is correct
4 Correct 6 ms 4984 KB Output is correct
5 Correct 6 ms 4984 KB Output is correct
6 Correct 6 ms 4988 KB Output is correct
7 Correct 6 ms 4984 KB Output is correct
8 Correct 6 ms 4984 KB Output is correct
9 Correct 6 ms 4984 KB Output is correct
10 Correct 6 ms 4984 KB Output is correct
11 Correct 6 ms 4984 KB Output is correct
12 Incorrect 6 ms 4984 KB Output isn't correct
13 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 6 ms 4984 KB Output is correct
2 Correct 6 ms 4956 KB Output is correct
3 Correct 6 ms 4984 KB Output is correct
4 Correct 6 ms 4984 KB Output is correct
5 Correct 6 ms 4984 KB Output is correct
6 Correct 6 ms 4988 KB Output is correct
7 Correct 6 ms 4984 KB Output is correct
8 Correct 6 ms 4984 KB Output is correct
9 Correct 6 ms 4984 KB Output is correct
10 Correct 6 ms 4984 KB Output is correct
11 Correct 6 ms 4984 KB Output is correct
12 Incorrect 6 ms 4984 KB Output isn't correct
13 Halted 0 ms 0 KB -