답안 #975875

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
975875 2024-05-06T01:46:19 Z Darren0724 케이크 (CEOI14_cake) C++17
0 / 100
2000 ms 7516 KB
#include <bits/stdc++.h>
using namespace std;
#define LCBorz ios_base::sync_with_stdio(false); cin.tie(0);
#define int long long
#define all(x) x.begin(), x.end()
#define endl '\n'
const int N=200005;
const int INF=1e18;
int32_t main() {
    LCBorz;
    int n,c;cin>>n>>c;
    vector<int> v(n);
    vector<int> ans(n);
    for(int i=0;i<n;i++){
        cin>>v[i];
    }
    auto cal=[&]()->void {
        int l=c-2,r=c;
        for(int i=1;i<n;i++){
            if(r==n||v[l]<v[r]){
                ans[l--]=i;
            }
            else{
                ans[r++]=i;
            }
        }
    };
    cal();
    int q;cin>>q;
    for(int i=0;i<q;i++){
        char c;cin>>c;
        if(c=='F'){
            int p;cin>>p;
            cout<<ans[p-1]<<endl;
        }
        else{
            int a,b;cin>>a>>b;a--;
            b=n+1-b;
            int k=v[a];
            for(int j=0;j<n;j++){
                if(v[j]>=k&&v[j]<b)v[j]--;
            }
            v[a]=b;
            cal();
        }
    }
    
    
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2048 ms 1332 KB Time limit exceeded
2 Execution timed out 2040 ms 1600 KB Time limit exceeded
3 Execution timed out 2011 ms 1372 KB Time limit exceeded
4 Execution timed out 2052 ms 1856 KB Time limit exceeded
5 Execution timed out 2036 ms 1344 KB Time limit exceeded
6 Execution timed out 2015 ms 1464 KB Time limit exceeded
7 Execution timed out 2041 ms 1468 KB Time limit exceeded
8 Execution timed out 2032 ms 1468 KB Time limit exceeded
# 결과 실행 시간 메모리 Grader output
1 Incorrect 56 ms 3916 KB Output isn't correct
2 Incorrect 34 ms 3664 KB Output isn't correct
3 Incorrect 32 ms 3724 KB Output isn't correct
4 Correct 0 ms 348 KB Output is correct
5 Incorrect 100 ms 7252 KB Output isn't correct
6 Incorrect 96 ms 7516 KB Output isn't correct
7 Incorrect 60 ms 7252 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 326 ms 848 KB Output isn't correct
2 Incorrect 637 ms 1024 KB Output isn't correct
3 Execution timed out 2037 ms 1904 KB Time limit exceeded
4 Execution timed out 2053 ms 1996 KB Time limit exceeded
5 Incorrect 649 ms 1872 KB Output isn't correct
6 Execution timed out 2043 ms 2148 KB Time limit exceeded
7 Execution timed out 2059 ms 1520 KB Time limit exceeded
8 Execution timed out 2037 ms 2772 KB Time limit exceeded
9 Execution timed out 2061 ms 6144 KB Time limit exceeded
10 Execution timed out 2035 ms 5112 KB Time limit exceeded
11 Execution timed out 2009 ms 1684 KB Time limit exceeded
12 Execution timed out 2029 ms 5460 KB Time limit exceeded
13 Execution timed out 2017 ms 6396 KB Time limit exceeded