답안 #975880

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
975880 2024-05-06T01:51:58 Z Darren0724 케이크 (CEOI14_cake) C++17
35 / 100
2000 ms 3076 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=1e9;
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(l==-1){
                ans[r++]=i;
                continue;
            }
            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 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 11 ms 348 KB Output is correct
5 Correct 198 ms 660 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2037 ms 348 KB Time limit exceeded
2 Execution timed out 2051 ms 508 KB Time limit exceeded
3 Execution timed out 2056 ms 348 KB Time limit exceeded
4 Execution timed out 2033 ms 344 KB Time limit exceeded
5 Execution timed out 2025 ms 600 KB Time limit exceeded
6 Execution timed out 2085 ms 604 KB Time limit exceeded
7 Execution timed out 2020 ms 760 KB Time limit exceeded
8 Execution timed out 2035 ms 624 KB Time limit exceeded
# 결과 실행 시간 메모리 Grader output
1 Correct 55 ms 1620 KB Output is correct
2 Correct 32 ms 1616 KB Output is correct
3 Correct 34 ms 1564 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 93 ms 3008 KB Output is correct
6 Correct 87 ms 3076 KB Output is correct
7 Correct 56 ms 2708 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 307 ms 804 KB Output is correct
2 Correct 489 ms 476 KB Output is correct
3 Execution timed out 2050 ms 852 KB Time limit exceeded
4 Execution timed out 2040 ms 1164 KB Time limit exceeded
5 Correct 604 ms 728 KB Output is correct
6 Execution timed out 2024 ms 968 KB Time limit exceeded
7 Execution timed out 2017 ms 896 KB Time limit exceeded
8 Execution timed out 2067 ms 1116 KB Time limit exceeded
9 Execution timed out 2041 ms 2428 KB Time limit exceeded
10 Correct 1986 ms 1456 KB Output is correct
11 Execution timed out 2045 ms 604 KB Time limit exceeded
12 Execution timed out 2035 ms 2268 KB Time limit exceeded
13 Execution timed out 2064 ms 2416 KB Time limit exceeded