Submission #586570

# Submission time Handle Problem Language Result Execution time Memory
586570 2022-06-30T11:50:48 Z Vanilla Ancient Books (IOI17_books) C++17
0 / 100
4 ms 304 KB
#include <bits/stdc++.h>
#include "books.h"
using namespace std;
typedef long long int64;

int64 minimum_walk(vector<int> a, int s) {
	int n = a.size();
	int64 rs = 0;
	for (int i = 0; i < n; i++){
		int sp = 0;
		for (int j = 0; j < n - i - 1; j++){
			if (a[j] > a[j + 1]) {
				swap(a[j], a[j + 1]);
				sp = j;
			}
		}
		for (int j = sp; j >= 1; j--){
			if (a[j] > a[j-1]) {
				swap(a[j], a[j - 1]);
			}
		}
		if (sp == 0) break;
		rs+= sp * 2;
	}
	return rs;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Incorrect 1 ms 300 KB 3rd lines differ - on the 1st token, expected: '8', found: '6'
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Incorrect 1 ms 300 KB 3rd lines differ - on the 1st token, expected: '8', found: '6'
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Incorrect 1 ms 300 KB 3rd lines differ - on the 1st token, expected: '8', found: '6'
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 304 KB 3rd lines differ - on the 1st token, expected: '3304', found: '997002'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Incorrect 1 ms 300 KB 3rd lines differ - on the 1st token, expected: '8', found: '6'
4 Halted 0 ms 0 KB -