# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
761389 | 2023-06-19T15:04:51 Z | Rafi22 | 고대 책들 (IOI17_books) | C++14 | 1 ms | 212 KB |
#include <bits/stdc++.h> using namespace std; #define endl '\n' #define st first #define nd second #define pb push_back #define sz(x) (int)(x).size() #define all(x) (x).begin(), (x).end() #define ll long long ll mod=1000000007; int inf=1000000007; ll infl=1000000000000000007; const int N=1000007; ll minimum_walk(vector<int>p,int s) { int n=sz(p); ll ans=0,l=-1; for(int i=0;i<n;i++) { ans+=abs(p[i]-i); if(p[i]!=i) l=i; } int c=0,mx=0; for(int i=0;i<=l;i++) { mx=max(mx,p[i]); if(i!=n-1&&mx==i) ans+=2; } return ans; } /* int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cout<<minimum_walk({3, 2, 1, 0}, 0); return 0; }*/
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Incorrect | 0 ms | 212 KB | 3rd lines differ - on the 1st token, expected: '4', found: '6' |
6 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Incorrect | 0 ms | 212 KB | 3rd lines differ - on the 1st token, expected: '4', found: '6' |
6 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Incorrect | 0 ms | 212 KB | 3rd lines differ - on the 1st token, expected: '4', found: '6' |
6 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 212 KB | 3rd lines differ - on the 1st token, expected: '3304', found: '2744' |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Incorrect | 0 ms | 212 KB | 3rd lines differ - on the 1st token, expected: '4', found: '6' |
6 | Halted | 0 ms | 0 KB | - |