# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
676554 |
2022-12-31T08:46:28 Z |
vjudge1 |
Cake (CEOI14_cake) |
C++17 |
|
2000 ms |
4428 KB |
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#include <fstream>
#define int long long
#define endl '\n'
#define mod 1000000007;
using namespace std;
int A[250001];
signed main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int n,a; cin >> n >> a;
for(int i = 0; i < n; i++) cin >> A[i];
int t; cin >> t;
while(t--){
char x; int c,d; cin >> x >> c;
if(x == 'E'){
cin >> d;
int new_val = n - d + 1;
if(A[c - 1] > new_val){
for(int i = 0; i < n; i++){
if(A[i] >= new_val && A[i] < A[c - 1]){
A[i]++;
}
}
A[c - 1] = new_val;
}else if(A[c - 1] < new_val){
for(int i = 0; i < n; i++){
if(A[i] > A[c - 1] && A[i] <= new_val){
A[i]--;
}
}
A[c - 1] = new_val;
}
}else{
c--;
int l = a - 2, r = a, cnt = 0;
if(a - 1 == c){
cout << 0 << endl;
continue;
}
while(1){
int mx1 = 1e18, mx2 = 1e18;
cnt++;
if(l >= 0){
mx1 = A[l];
}
if(r < n){
mx2 = A[r];
}
if(mx1 < mx2){
if(l == c) break;
l--;
}else{
if(r == c) break;
r++;
}
}
cout << cnt << endl;
}
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
324 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
11 ms |
340 KB |
Output is correct |
5 |
Correct |
197 ms |
528 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2071 ms |
1768 KB |
Time limit exceeded |
2 |
Execution timed out |
2059 ms |
2288 KB |
Time limit exceeded |
3 |
Execution timed out |
2078 ms |
1908 KB |
Time limit exceeded |
4 |
Execution timed out |
2091 ms |
2416 KB |
Time limit exceeded |
5 |
Execution timed out |
2087 ms |
1356 KB |
Time limit exceeded |
6 |
Execution timed out |
2085 ms |
1524 KB |
Time limit exceeded |
7 |
Execution timed out |
2078 ms |
1356 KB |
Time limit exceeded |
8 |
Execution timed out |
2091 ms |
1512 KB |
Time limit exceeded |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2089 ms |
1864 KB |
Time limit exceeded |
2 |
Execution timed out |
2084 ms |
1796 KB |
Time limit exceeded |
3 |
Execution timed out |
2087 ms |
1852 KB |
Time limit exceeded |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Execution timed out |
2085 ms |
2728 KB |
Time limit exceeded |
6 |
Execution timed out |
2067 ms |
2704 KB |
Time limit exceeded |
7 |
Execution timed out |
2084 ms |
2636 KB |
Time limit exceeded |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
291 ms |
588 KB |
Output is correct |
2 |
Correct |
480 ms |
712 KB |
Output is correct |
3 |
Execution timed out |
2064 ms |
1124 KB |
Time limit exceeded |
4 |
Execution timed out |
2091 ms |
1136 KB |
Time limit exceeded |
5 |
Correct |
584 ms |
1364 KB |
Output is correct |
6 |
Execution timed out |
2082 ms |
1220 KB |
Time limit exceeded |
7 |
Execution timed out |
2088 ms |
1712 KB |
Time limit exceeded |
8 |
Execution timed out |
2076 ms |
1228 KB |
Time limit exceeded |
9 |
Execution timed out |
2082 ms |
2428 KB |
Time limit exceeded |
10 |
Correct |
1920 ms |
4428 KB |
Output is correct |
11 |
Execution timed out |
2089 ms |
1244 KB |
Time limit exceeded |
12 |
Execution timed out |
2079 ms |
2004 KB |
Time limit exceeded |
13 |
Execution timed out |
2037 ms |
2516 KB |
Time limit exceeded |