# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
292728 | 2020-09-07T12:31:33 Z | Saboon | 고대 책들 (IOI17_books) | C++17 | 1 ms | 384 KB |
//#include "books.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; const int maxn = 1e6 + 10; bool pre[maxn], suf[maxn]; long long minimum_walk(vector<int> p, int s){ int n = p.size(); for (int i = 0; i < n; i++){ if (p[i] != i) break; pre[i] = 1; } for (int i = n-1; i >= 0; i--){ if (p[i] != i) break; suf[i] = 1; } set<int> S; ll answer = 0; for (int i = 0; i < n-1; i++){ S.insert(p[i]); if (!S.empty() and *S.begin() == i) S.erase(S.begin()); int cnt = 0, q = S.size(); if (i < s) cnt = max(cnt, 1-pre[i]); else cnt = max(cnt, 1-suf[i+1]); answer += 2*cnt; } return answer; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 384 KB | Output is correct |
2 | Correct | 1 ms | 384 KB | Output is correct |
3 | Incorrect | 0 ms | 256 KB | 3rd lines differ - on the 1st token, expected: '8', found: '6' |
4 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 384 KB | Output is correct |
2 | Correct | 1 ms | 384 KB | Output is correct |
3 | Incorrect | 0 ms | 256 KB | 3rd lines differ - on the 1st token, expected: '8', found: '6' |
4 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 384 KB | Output is correct |
2 | Correct | 1 ms | 384 KB | Output is correct |
3 | Incorrect | 0 ms | 256 KB | 3rd lines differ - on the 1st token, expected: '8', found: '6' |
4 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 384 KB | 3rd lines differ - on the 1st token, expected: '3304', found: '1998' |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 384 KB | Output is correct |
2 | Correct | 1 ms | 384 KB | Output is correct |
3 | Incorrect | 0 ms | 256 KB | 3rd lines differ - on the 1st token, expected: '8', found: '6' |
4 | Halted | 0 ms | 0 KB | - |