Contest Duration: - (local time) (110 minutes) Back to Home

Submission #979653

Source Code Expand

Copy
```#include <bits/stdc++.h>
using namespace std;

#define _p(...) (void)printf(__VA_ARGS__)
#define forr(x,arr) for(auto&& x:arr)
#define _rep2(i,n) _rep3(i,0,n)
#define _rep3(i,a,b) for(int i=int(a);i<int(b);++i)
#define _rrep2(i,n) _rrep3(i,0,n)
#define _rrep3(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define all(x) (x).begin(), (x).end()
#define bit(n) (1LL<<(n))
#define sz(x) ((int)(x).size())
#define fst first
#define snd second
using ll=long long;using pii=pair<int,int>;using vb=vector<bool>;
using vi=vector<int>;using vvi=vector<vi>;using vvvi=vector<vvi>;
using vl=vector<ll>;using vvl=vector<vl>;using vvvl=vector<vvl>;
using vd=vector<double>;using vvd=vector<vd>;using vvvd=vector<vvd>;
using vpii=vector<pii>;using vvpii=vector<vpii>;using vvvpii=vector<vvpii>;
template <typename T> T read() {T t; cin >> t; return t;}

void Main() {
vector<int> P(n);
rep(i, n) P[i] = read<int>() - 1;

vi A(n), B(n);
rep(i, n) A[i] = i * 30000;
rep(i, n) B[n-i-1] = i * 30000;

//cout << "A:"; rep(ii,sz(A)) cout << ' ' << A[ii]; cout << endl;
//cout << "B:"; rep(ii,sz(B)) cout << ' ' << B[ii]; cout << endl;

int psum = -1;

rep(i, n) {
int p = P[i];
int sum = A[p] + B[p];
if (sum <= psum) {
int d = psum - sum + 1;
A[p] += d;
}
psum = A[p] + B[p];
}

rep(i, n) {
_p(i+1<n?"%d ":"%d\n", A[i] + 1);
}

rep(i, n) {
_p(i+1<n?"%d ":"%d\n", B[i] + 1);
}
}
int main() { cin.tie(nullptr); ios::sync_with_stdio(false); Main(); return 0; }
```

#### Submission Info

Submission Time 2016-11-12 21:41:03+0900 B - Construct Sequences shiratty8 C++14 (GCC 5.4.1) 400 1762 Byte AC 9 ms 896 KB

#### Judge Result

Set Name Sample All
Score / Max Score 0 / 0 400 / 400
Status
 AC × 3
 AC × 22
Set Name Test Cases
Sample example0.txt, example1.txt, example2.txt
All 000.txt, 001.txt, 002.txt, 003.txt, 004.txt, 005.txt, 006.txt, 007.txt, 008.txt, 009.txt, 010.txt, 011.txt, 012.txt, 013.txt, 014.txt, 015.txt, 016.txt, 017.txt, 018.txt, example0.txt, example1.txt, example2.txt
Case Name Status Exec Time Memory
000.txt AC 3 ms 256 KB
001.txt AC 3 ms 256 KB
002.txt AC 3 ms 256 KB
003.txt AC 3 ms 256 KB
004.txt AC 3 ms 256 KB
005.txt AC 8 ms 896 KB
006.txt AC 4 ms 384 KB
007.txt AC 8 ms 768 KB
008.txt AC 5 ms 512 KB
009.txt AC 8 ms 896 KB
010.txt AC 8 ms 896 KB
011.txt AC 9 ms 896 KB
012.txt AC 9 ms 896 KB
013.txt AC 8 ms 896 KB
014.txt AC 9 ms 896 KB
015.txt AC 8 ms 896 KB
016.txt AC 8 ms 896 KB
017.txt AC 8 ms 896 KB
018.txt AC 8 ms 896 KB
example0.txt AC 3 ms 256 KB
example1.txt AC 2 ms 256 KB
example2.txt AC 3 ms 256 KB