Submission #148860

# Submission time Handle Problem Language Result Execution time Memory
148860 2019-09-01T05:16:35 Z nandonathaniel Arranging Shoes (IOI19_shoes) C++14
45 / 100
33 ms 2676 KB
#include "shoes.h"
#include <bits/stdc++.h>
using namespace std;

long long count_swaps(vector<int> s) {
	vector<int> v;
	for(int i=0;i<s.size();i++){
		if(s[i]<0)v.push_back(i);
	}
	long long now=0,ans=0;
	for(int i=0;i<s.size();i++){
		if(i%2==0){
			ans+=abs(v[now]-i);
			now++;
		}
	}
	return ans;
}

Compilation message

shoes.cpp: In function 'long long int count_swaps(std::vector<int>)':
shoes.cpp:7:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i=0;i<s.size();i++){
              ~^~~~~~~~~
shoes.cpp:11:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i=0;i<s.size();i++){
              ~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 348 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 348 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Incorrect 2 ms 376 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 348 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 296 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 256 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 256 KB Output is correct
9 Correct 2 ms 256 KB Output is correct
10 Correct 2 ms 424 KB Output is correct
11 Correct 2 ms 292 KB Output is correct
12 Correct 2 ms 256 KB Output is correct
13 Correct 2 ms 256 KB Output is correct
14 Correct 2 ms 256 KB Output is correct
15 Correct 2 ms 376 KB Output is correct
16 Correct 2 ms 256 KB Output is correct
17 Correct 2 ms 256 KB Output is correct
18 Correct 2 ms 256 KB Output is correct
19 Correct 2 ms 376 KB Output is correct
20 Correct 5 ms 504 KB Output is correct
21 Correct 5 ms 508 KB Output is correct
22 Correct 30 ms 2548 KB Output is correct
23 Correct 27 ms 2548 KB Output is correct
24 Correct 32 ms 2676 KB Output is correct
25 Correct 26 ms 2548 KB Output is correct
26 Correct 31 ms 2548 KB Output is correct
27 Correct 26 ms 2548 KB Output is correct
28 Correct 28 ms 2560 KB Output is correct
29 Correct 27 ms 2548 KB Output is correct
30 Correct 28 ms 2548 KB Output is correct
31 Correct 30 ms 2552 KB Output is correct
32 Correct 27 ms 2520 KB Output is correct
33 Correct 26 ms 2548 KB Output is correct
34 Correct 27 ms 2548 KB Output is correct
35 Correct 2 ms 376 KB Output is correct
36 Correct 2 ms 256 KB Output is correct
37 Correct 30 ms 2520 KB Output is correct
38 Correct 27 ms 2548 KB Output is correct
39 Correct 28 ms 2676 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 33 ms 2548 KB Output is correct
6 Correct 32 ms 2464 KB Output is correct
7 Correct 33 ms 2548 KB Output is correct
8 Correct 32 ms 2540 KB Output is correct
9 Correct 33 ms 2548 KB Output is correct
10 Correct 32 ms 2552 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 348 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Incorrect 2 ms 376 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 348 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Incorrect 2 ms 376 KB Output isn't correct
4 Halted 0 ms 0 KB -