Submission #54091400
Source Code Expand
Copy
// !JOY#pragma GCC optimize("Ofast")#pragma GCC target("avx,avx2,fma")#include <bits/stdc++.h>#define ll long long#define ld long double#define pb(a) push_back(a)#define all(v) v.begin(), v.end()#define rall(v) v.rbegin(), v.rend()#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL)#define coutyes cout<<"YES\n"#define coutno cout<<"NO\n"#define endl "\n"#define hell 1000000007using namespace std;int M = 1000000;int sieve[1000001];
// !JOY #pragma GCC optimize("Ofast") #pragma GCC target("avx,avx2,fma") #include <bits/stdc++.h> #define ll long long #define ld long double #define pb(a) push_back(a) #define all(v) v.begin(), v.end() #define rall(v) v.rbegin(), v.rend() #define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL) #define coutyes cout<<"YES\n" #define coutno cout<<"NO\n" #define endl "\n" #define hell 1000000007 using namespace std; int M = 1000000; int sieve[1000001]; void createSieve() { for (int i = 2; i <= M; i++) { sieve[i] = 1; } for (int i = 2; i * i <= M; i++) { if (sieve[i] == 1) { if (i == 2) { for (int j = i * i; j <= M; j += i) { sieve[j] = 2; } } else { for (int j = i * i; j <= M; j += 2 * i) { if (sieve[j] == 1) { sieve[j] = i; } } } } } } bool isPrime(ll n) { if (n <= 1) return false; for (ll i = 2; i * i <= n; i++) { if (n % i == 0) return false; } return true; } ll gcd(ll a, ll b) { if (a == 0) return b; return gcd(b % a, a); } vector<ll> factors(ll n) { vector<ll> f; for (ll x = 2; x*x <= n; x++) { while (n%x == 0) { f.push_back(x); n /= x; } } if (n > 1) f.push_back(n); return f; } ll powe(ll a, ll n) { ll r = 1; while (n) { if (n % 2) { r = ((r % hell) * (a % hell)) % hell; n--; } else { a = ((a % hell) * (a % hell)) % hell; n = n / 2; } } return r; } ll dx[] = {0, 0, 1, -1}; ll dy[] = {1, -1, 0, 0}; ll dfs(ll i, ll j, vector<vector<ll>> &vi, ll n, ll m, vector<vector<ll>> & v) { ll ans = 0; if (!vi[i][j]) { vi[i][j] = 1; ans = v[i][j]; for (int k = 0; k < 4; k++) { if (i + dx[k] >= 0 && i + dx[k] < n && j + dy[k] >= 0 && j + dy[k] < m && v[i + dx[k]][j + dy[k]] != 0 && vi[i + dx[k]][j + dy[k]] == 0) { ans += dfs(i + dx[k], j + dy[k], vi, n, m, v); } } } return ans; } const int N = 1e5+10; vector<int>g[N]; bool vis[N]; void _dfs(int vertex){ if(!vis[vertex]){ vis[vertex]=true; for (int child: g[vertex]) { if(!vis[child]) _dfs(child); } } } void solve() { ll n,l,r; cin>>n>>l>>r; vector<ll>v(n+1); for (int i = 1; i <= n; ++i) { v[i]=i; } for(int i=l;i<=(l+r)/2;i++){ // cout<<i<<' '; ll temp=v[i]; v[i]=v[r-i+l]; v[r-i+l]=temp; } for(int it=1;it<=n;it++)cout<<v[it]<<' '; cout<<endl; } int main() { fast_io; ll t; t=1; // cin>>t; while(t--) solve(); return 0; }
Submission Info
Submission Time | |
---|---|
Task | A - Subsegment Reverse |
User | Parzival01 |
Language | C++ 20 (gcc 12.2) |
Score | 100 |
Code Size | 3066 Byte |
Status | AC |
Exec Time | 1 ms |
Memory | 3616 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 100 / 100 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | sample_01.txt, sample_02.txt, sample_03.txt |
All | sample_01.txt, sample_02.txt, sample_03.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 |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
sample_01.txt | AC | 1 ms | 3400 KB |
sample_02.txt | AC | 1 ms | 3408 KB |
sample_03.txt | AC | 1 ms | 3444 KB |
test_01.txt | AC | 1 ms | 3388 KB |
test_02.txt | AC | 1 ms | 3448 KB |
test_03.txt | AC | 1 ms | 3444 KB |
test_04.txt | AC | 1 ms | 3472 KB |
test_05.txt | AC | 1 ms | 3612 KB |
test_06.txt | AC | 1 ms | 3420 KB |
test_07.txt | AC | 1 ms | 3464 KB |
test_08.txt | AC | 1 ms | 3464 KB |
test_09.txt | AC | 1 ms | 3616 KB |
test_10.txt | AC | 1 ms | 3484 KB |
test_11.txt | AC | 1 ms | 3332 KB |
test_12.txt | AC | 1 ms | 3424 KB |
test_13.txt | AC | 1 ms | 3412 KB |
test_14.txt | AC | 1 ms | 3416 KB |
test_15.txt | AC | 1 ms | 3448 KB |