Submission #1444230


Source Code Expand

#include <bits/stdc++.h>

using namespace std;

#define INF 1001000100010001000
#define MOD 1000000007
#define EPS 1e-10
#define int long long
#define rep(i, N) for (int i = 0; i < N; i++)
#define Rep(i, N) for (int i = 1; i < N; i++)
#define For(i, a, b) for (int i = (a); i < (b); i++)
#define pb push_back
#define eb emplece_back
#define mp make_pair
#define i_i pair<int, int>
#define vi vector<int>
#define vvi vector<vi >
#define vb vector<bool>
#define vvb vector<vb >
#define vp vector< i_i >
#define Edge pair< int, i_i >
#define all(a) (a).begin(), (a).end()
#define Int(x) int x; scanf("%lld", &x);
#define int2(x, y) int x, y; scanf("%lld %lld", &x, &y);
#define fir first
#define sec second
#define ffir first.first
#define fsec first.second
#define sfir second.first
#define ssec second.second

//int dxy[5] = {0, 1, 0, -1, 0};
// assign avl ncm dij geo2

signed main()
{
    Int(n);
    vi a(n), b(n);
    vi p(n);
    rep(i, n) {
        a[i] = i+1;
        b[i] = n - i;
        cin >> p[i];
    }

    int bef = p[0]-1;
    Rep(i, n) {
        int ptr = p[i]-1;
        if (ptr > bef) {
            a[ptr] += (a[bef] + b[bef]) + 1 - (b[ptr] + a[ptr]);
        } else {
            b[ptr] += (a[bef] + b[bef]) + 1 - (a[ptr] + b[ptr]);
        }

        bef = ptr;
    }
    rep(i, n-1) {
        std::cout << a[i] << " ";
    }cout << a[n-1] << endl;

    rep(i, n-1) {
        std::cout << b[i] << " ";
    }cout << b[n-1] << endl;

    return 0;
}

Submission Info

Submission Time
Task B - Construct Sequences
User Ti11192916
Language C++14 (GCC 5.4.1)
Score 0
Code Size 1534 Byte
Status WA
Exec Time 10 ms
Memory 896 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:23:40: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
 #define Int(x) int x; scanf("%lld", &x);
                                        ^
./Main.cpp:37:5: note: in expansion of macro ‘Int’
     Int(n);
     ^

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 400
Status
AC × 3
AC × 3
WA × 19
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 2 ms 256 KB
001.txt WA 2 ms 256 KB
002.txt WA 2 ms 256 KB
003.txt WA 1 ms 256 KB
004.txt WA 2 ms 256 KB
005.txt WA 10 ms 896 KB
006.txt WA 3 ms 384 KB
007.txt WA 9 ms 896 KB
008.txt WA 5 ms 640 KB
009.txt WA 9 ms 896 KB
010.txt WA 10 ms 896 KB
011.txt WA 10 ms 896 KB
012.txt WA 10 ms 896 KB
013.txt WA 10 ms 896 KB
014.txt WA 10 ms 896 KB
015.txt WA 10 ms 896 KB
016.txt WA 10 ms 896 KB
017.txt WA 10 ms 896 KB
018.txt WA 10 ms 896 KB
example0.txt AC 1 ms 256 KB
example1.txt AC 1 ms 256 KB
example2.txt AC 1 ms 256 KB