답안 #72695

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
72695 2018-08-26T15:25:59 Z mhnd 고대 책들 (IOI17_books) C++14
0 / 100
3 ms 356 KB
#include "books.h"
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
const int N = 2e5+50;
const int oo = 1e9;
const int mod = 1e9+7;

ll minimum_walk(vector<int> p, int s) {
	ll ans = 0;
	int mx=-1;
	for(int i=0;i<p.size();i++){
		ans += abs(i-p[i]);
		mx = max(mx,p[i]);
	}
	for(int i=0;i<s;i++){
		if(p[i]!=i)break;
	}
	for(int i=p.size()-1;i>s;i--){
		if(p[i]!=i)break;
	}
	return ans - 2;
}

Compilation message

books.cpp: In function 'll minimum_walk(std::vector<int>, int)':
books.cpp:15:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i=0;i<p.size();i++){
              ~^~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 248 KB 3rd lines differ - on the 1st token, expected: '6', found: '2'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 248 KB 3rd lines differ - on the 1st token, expected: '6', found: '2'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 248 KB 3rd lines differ - on the 1st token, expected: '6', found: '2'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 356 KB 3rd lines differ - on the 1st token, expected: '3304', found: '2742'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 248 KB 3rd lines differ - on the 1st token, expected: '6', found: '2'
2 Halted 0 ms 0 KB -