Submission #980060
Source Code Expand
#include <iostream>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <list>
#include <vector>
#include <complex>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <bitset>
#include <ctime>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cassert>
#include <cstddef>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <sstream>
#include <fstream>
using namespace std;
#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define FOR(i, a, b) for (int (i) = (a); (i) < (b); (i)++)
#define RREP(i, a) for(int (i) = (a) - 1; (i) >= 0; (i)--)
#define FORR(i, a, b) for(int (i) = (a) - 1; (i) >= (b); (i)--)
#define DEBUG(C) cerr << #C << " = " << C << endl;
using LL = long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VL = vector<LL>;
using VVL = vector<VL>;
using VD = vector<double>;
using VVD = vector<VD>;
using PII = pair<int, int>;
using PDD = pair<double, double>;
using PLL = pair<LL, LL>;
using VPII = vector<PII>;
#define ALL(a) begin((a)), end((a))
#define RALL(a) rbegin((a)), rend((a))
#define SORT(a) sort(ALL((a)))
#define RSORT(a) sort(RALL((a)))
#define REVERSE(a) reverse(ALL((a)))
#define MP make_pair
#define FORE(a, b) for (auto &&a : (b))
#define FIND(s, e) ((s).find(e) != (s).end())
#define EB emplace_back
const int INF = 1e9;
const int MOD = INF + 7;
const LL LLINF = 1e18;
signed main(void) {
int N; cin >> N;
VI p(N);
REP(i, N) scanf("%d", &p[i]);
VI hoge(N);
int cnt = 1;
for (auto itr = hoge.rbegin(); itr != hoge.rend(); itr++) {
*itr = INF - cnt++;
}
VI sum(N);
REP(i, N) sum[p[i] - 1] = hoge[i];
//REP(i, N) cerr << sum[i] << " ";cerr << endl;
VI a(N), b(N);
cnt = 0;
REP(i, N) {
a[i] = (i + 1) + cnt;
b[i] = sum[i] - a[i] - cnt;
if (i == 0) continue;
if (a[i] <= a[i - 1]) {
a[i]++;b[i]--;cnt++;
}
if (b[i] >= b[i - 1]) {
a[i]++;b[i]--;cnt++;
}
}
REP(i, N) printf("%d ", a[i]);
cout << endl;
REP(i, N) printf("%d ", b[i]);
cout << endl;
}
Submission Info
Submission Time
2016-11-12 22:02:43+0900
Task
B - Construct Sequences
User
sekiya9311
Language
C++14 (GCC 5.4.1)
Score
0
Code Size
2294 Byte
Status
WA
Exec Time
9 ms
Memory
896 KB
Compile Error
./Main.cpp: In function ‘int main()’:
./Main.cpp:63:33: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
REP(i, N) scanf("%d", &p[i]);
^
Judge Result
Set Name
Sample
All
Score / Max Score
0 / 0
0 / 400
Status
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
WA
3 ms
256 KB
001.txt
WA
3 ms
256 KB
002.txt
WA
3 ms
256 KB
003.txt
WA
3 ms
256 KB
004.txt
WA
3 ms
256 KB
005.txt
WA
9 ms
896 KB
006.txt
WA
4 ms
384 KB
007.txt
WA
8 ms
896 KB
008.txt
WA
6 ms
640 KB
009.txt
WA
8 ms
896 KB
010.txt
WA
9 ms
896 KB
011.txt
WA
9 ms
896 KB
012.txt
WA
9 ms
896 KB
013.txt
WA
9 ms
896 KB
014.txt
WA
9 ms
896 KB
015.txt
WA
9 ms
896 KB
016.txt
WA
9 ms
896 KB
017.txt
WA
9 ms
896 KB
018.txt
WA
9 ms
896 KB
example0.txt
AC
2 ms
256 KB
example1.txt
AC
2 ms
256 KB
example2.txt
AC
2 ms
256 KB