# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
289080 | 2020-09-02T10:30:20 Z | JoMee | 고대 책들 (IOI17_books) | C++17 | 1 ms | 384 KB |
#include "books.h" #include <bits/stdc++.h> using namespace std; #define rep(i,a,n) for(int i = a; i<n; i++) #define per(i,a,n) for(int i = n-1; i>=a; i--) long long minimum_walk(vector<int> p, int s) { vector<long long> sm(p.size(),0); rep(i,0,p.size()){ if(i < p[i])sm[i]++,sm[p[i]]--; } rep(i,1,sm.size())sm[i] += sm[i-1]; int rm = s; per(i,s,p.size()){ if(sm[i] != 0){ rm = i; break; } } rm++; int lm = s; rep(i,0,s){ if(sm[i] != 0){ lm = i; break; } } long long res = 0; rep(i,0,rm){ if(sm[i] != 0)res+=2*(sm[i]-1); } res += 2*(rm-lm); return res; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 256 KB | Output is correct |
2 | Correct | 0 ms | 256 KB | Output is correct |
3 | Correct | 0 ms | 256 KB | Output is correct |
4 | Correct | 0 ms | 256 KB | Output is correct |
5 | Correct | 0 ms | 256 KB | Output is correct |
6 | Correct | 0 ms | 256 KB | Output is correct |
7 | Correct | 0 ms | 256 KB | Output is correct |
8 | Correct | 0 ms | 256 KB | Output is correct |
9 | Incorrect | 1 ms | 256 KB | 3rd lines differ - on the 1st token, expected: '0', found: '2' |
10 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 256 KB | Output is correct |
2 | Correct | 0 ms | 256 KB | Output is correct |
3 | Correct | 0 ms | 256 KB | Output is correct |
4 | Correct | 0 ms | 256 KB | Output is correct |
5 | Correct | 0 ms | 256 KB | Output is correct |
6 | Correct | 0 ms | 256 KB | Output is correct |
7 | Correct | 0 ms | 256 KB | Output is correct |
8 | Correct | 0 ms | 256 KB | Output is correct |
9 | Incorrect | 1 ms | 256 KB | 3rd lines differ - on the 1st token, expected: '0', found: '2' |
10 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 256 KB | Output is correct |
2 | Correct | 0 ms | 256 KB | Output is correct |
3 | Correct | 0 ms | 256 KB | Output is correct |
4 | Correct | 0 ms | 256 KB | Output is correct |
5 | Correct | 0 ms | 256 KB | Output is correct |
6 | Correct | 0 ms | 256 KB | Output is correct |
7 | Correct | 0 ms | 256 KB | Output is correct |
8 | Correct | 0 ms | 256 KB | Output is correct |
9 | Incorrect | 1 ms | 256 KB | 3rd lines differ - on the 1st token, expected: '0', found: '2' |
10 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 384 KB | 3rd lines differ - on the 1st token, expected: '3304', found: '2744' |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 256 KB | Output is correct |
2 | Correct | 0 ms | 256 KB | Output is correct |
3 | Correct | 0 ms | 256 KB | Output is correct |
4 | Correct | 0 ms | 256 KB | Output is correct |
5 | Correct | 0 ms | 256 KB | Output is correct |
6 | Correct | 0 ms | 256 KB | Output is correct |
7 | Correct | 0 ms | 256 KB | Output is correct |
8 | Correct | 0 ms | 256 KB | Output is correct |
9 | Incorrect | 1 ms | 256 KB | 3rd lines differ - on the 1st token, expected: '0', found: '2' |
10 | Halted | 0 ms | 0 KB | - |