Submission #66751921
Source Code Expand
Copy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#ifndef _Alignof
#define _Alignof __alignof__
#endif
#include <bits/stdc++.h>
#define LOOP(n) for (int _i = 0; _i < (n); _i++)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define RREP(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, r, n) for (int i = (r); i < (n); ++i)
#define ALL(obj) begin(obj), end(obj)
#define yes "Yes"
#define no "No"
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ll,int> pli;
typedef pair<int,ll> pil;
typedef vector<vector<int>> vvi;
typedef vector<vector<ll>> vvl;
const vector<char> alpha = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};
const ll INF = 1000000007;
const ll MOD=10000;
template<typename T> inline bool chmax(T &a, T b) { return ((a < b) ? (a = b, true) : (false)); }
template<typename T> inline bool chmin(T &a, T b) { return ((a > b) ? (a = b, true) : (false)); }
int main(){
int N, Q;
cin >> N >> Q;
vector<int> A(N);
REP(i, N) A[i] = i + 1;
int ofs = 0;
REP(i, Q) {
int t;
cin >> t;
if (t == 1) {
int p, x;
cin >> p >> x;
int pos = (p - 1 + ofs) % N;
A[pos] = x;
}
else if (t == 2) {
int p;
cin >> p;
int real_pos = (p - 1 + ofs) % N;
cout << A[real_pos] << endl;
}
else {
int k;
cin >> k;
ofs = (ofs + k) % N;
}
}
}
Submission Info
| Submission Time |
|
| Task |
C - Rotatable Array |
| User |
una_o0 |
| Language |
C++ 17 (gcc 12.2) |
| Score |
300 |
| Code Size |
1654 Byte |
| Status |
AC |
| Exec Time |
399 ms |
| Memory |
7224 KiB |
Judge Result
| Set Name |
Sample |
All |
| Score / Max Score |
0 / 0 |
300 / 300 |
| Status |
|
|
| Set Name |
Test Cases |
| Sample |
sample_01.txt, sample_02.txt |
| All |
sample_01.txt, sample_02.txt, test_01.txt, test_02.txt, test_03.txt, test_04.txt, test_05.txt, test_06.txt, test_07.txt, test_08.txt, test_09.txt, test_10.txt, test_11.txt, test_12.txt, test_13.txt, test_14.txt, test_15.txt, test_16.txt, test_17.txt, test_18.txt, test_19.txt, test_20.txt, test_21.txt, test_22.txt, test_23.txt, test_24.txt, test_25.txt, test_26.txt, test_27.txt, test_28.txt, test_29.txt, test_30.txt, test_31.txt, test_32.txt, test_33.txt, test_34.txt, test_35.txt, test_36.txt, test_37.txt, test_38.txt, test_39.txt, test_40.txt, test_41.txt, test_42.txt, test_43.txt, test_44.txt |
| Case Name |
Status |
Exec Time |
Memory |
| sample_01.txt |
AC |
1 ms |
3468 KiB |
| sample_02.txt |
AC |
3 ms |
7028 KiB |
| test_01.txt |
AC |
1 ms |
3464 KiB |
| test_02.txt |
AC |
1 ms |
3656 KiB |
| test_03.txt |
AC |
1 ms |
3456 KiB |
| test_04.txt |
AC |
217 ms |
7132 KiB |
| test_05.txt |
AC |
214 ms |
7080 KiB |
| test_06.txt |
AC |
215 ms |
7124 KiB |
| test_07.txt |
AC |
216 ms |
7100 KiB |
| test_08.txt |
AC |
216 ms |
7072 KiB |
| test_09.txt |
AC |
219 ms |
7224 KiB |
| test_10.txt |
AC |
118 ms |
3504 KiB |
| test_11.txt |
AC |
152 ms |
3372 KiB |
| test_12.txt |
AC |
113 ms |
3544 KiB |
| test_13.txt |
AC |
368 ms |
3652 KiB |
| test_14.txt |
AC |
221 ms |
7156 KiB |
| test_15.txt |
AC |
185 ms |
3496 KiB |
| test_16.txt |
AC |
216 ms |
3464 KiB |
| test_17.txt |
AC |
315 ms |
3628 KiB |
| test_18.txt |
AC |
144 ms |
5272 KiB |
| test_19.txt |
AC |
128 ms |
7012 KiB |
| test_20.txt |
AC |
344 ms |
3436 KiB |
| test_21.txt |
AC |
194 ms |
3472 KiB |
| test_22.txt |
AC |
200 ms |
3716 KiB |
| test_23.txt |
AC |
143 ms |
3532 KiB |
| test_24.txt |
AC |
258 ms |
7152 KiB |
| test_25.txt |
AC |
323 ms |
3504 KiB |
| test_26.txt |
AC |
101 ms |
3532 KiB |
| test_27.txt |
AC |
361 ms |
3516 KiB |
| test_28.txt |
AC |
214 ms |
4744 KiB |
| test_29.txt |
AC |
222 ms |
7128 KiB |
| test_30.txt |
AC |
129 ms |
3496 KiB |
| test_31.txt |
AC |
226 ms |
3496 KiB |
| test_32.txt |
AC |
339 ms |
3516 KiB |
| test_33.txt |
AC |
110 ms |
5224 KiB |
| test_34.txt |
AC |
399 ms |
7116 KiB |
| test_35.txt |
AC |
187 ms |
3500 KiB |
| test_36.txt |
AC |
189 ms |
3472 KiB |
| test_37.txt |
AC |
134 ms |
3536 KiB |
| test_38.txt |
AC |
365 ms |
3460 KiB |
| test_39.txt |
AC |
179 ms |
7224 KiB |
| test_40.txt |
AC |
97 ms |
3464 KiB |
| test_41.txt |
AC |
353 ms |
3444 KiB |
| test_42.txt |
AC |
200 ms |
3656 KiB |
| test_43.txt |
AC |
220 ms |
6808 KiB |
| test_44.txt |
AC |
226 ms |
7120 KiB |