답안 #58448

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
58448 2018-07-17T21:02:24 Z reality 고대 책들 (IOI17_books) C++17
0 / 100
3 ms 676 KB
#include "books.h"
#include "bits/stdc++.h"
using namespace std;
#define fi first
#define se second
#define ll long long
#define dbg(v) cerr<<#v<<" = "<<v<<'\n'
#define vi vector<int>
#define vl vector <ll>
#define pii pair<int,int>
#define mp make_pair
#define db long double
#define pb push_back
#define all(s) s.begin(),s.end()
template < class T > T smin(T &a,T b) {if (a > b) a = b;return a;}
template < class T > T smax(T &a,T b) {if (a < b) a = b;return a;}
#include "books.h"
long long minimum_walk(std::vector<int> p, int s) {
	int n = p.size();
	ll ans = -2;
	while (!p.empty() && p.back() == n - 1)
		--n,p.pop_back();
	for (int i = 0;i < n;++i)
		ans += abs(i - p[i]);
	int mx = 0;
	for (int i = 0;i < n;++i)
		smax(mx,p[i]),ans += 2 * (i == mx);
	return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 3 ms 564 KB Output is correct
4 Correct 3 ms 580 KB Output is correct
5 Correct 2 ms 580 KB Output is correct
6 Correct 3 ms 580 KB Output is correct
7 Correct 2 ms 676 KB Output is correct
8 Correct 2 ms 676 KB Output is correct
9 Incorrect 2 ms 676 KB 3rd lines differ - on the 1st token, expected: '0', found: '-2'
10 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 3 ms 564 KB Output is correct
4 Correct 3 ms 580 KB Output is correct
5 Correct 2 ms 580 KB Output is correct
6 Correct 3 ms 580 KB Output is correct
7 Correct 2 ms 676 KB Output is correct
8 Correct 2 ms 676 KB Output is correct
9 Incorrect 2 ms 676 KB 3rd lines differ - on the 1st token, expected: '0', found: '-2'
10 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 3 ms 564 KB Output is correct
4 Correct 3 ms 580 KB Output is correct
5 Correct 2 ms 580 KB Output is correct
6 Correct 3 ms 580 KB Output is correct
7 Correct 2 ms 676 KB Output is correct
8 Correct 2 ms 676 KB Output is correct
9 Incorrect 2 ms 676 KB 3rd lines differ - on the 1st token, expected: '0', found: '-2'
10 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 676 KB 3rd lines differ - on the 1st token, expected: '3304', found: '2744'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 3 ms 564 KB Output is correct
4 Correct 3 ms 580 KB Output is correct
5 Correct 2 ms 580 KB Output is correct
6 Correct 3 ms 580 KB Output is correct
7 Correct 2 ms 676 KB Output is correct
8 Correct 2 ms 676 KB Output is correct
9 Incorrect 2 ms 676 KB 3rd lines differ - on the 1st token, expected: '0', found: '-2'
10 Halted 0 ms 0 KB -