Submission #980052


Source Code Expand

#include <iostream>
#include <vector>
using namespace std;

int main()
{
    int n; cin>>n;
    vector<int> p(n);
    for(int i=0; i<n; ++i) {
        int t; cin>>t; p[t-1]=i;
    }

    vector<long> a(n), b(n);
    for(int i=0; i<n; ++i) a[i]=40000*(i+1);

    int x=p[n-1];
    b[x]=40000*n;
    auto m=a[x]+b[x];
    for(int i=n-2; i>=0; --i) {
        x=p[i];
        b[x]=m-a[x]-1;
        m=a[x]+b[x];
    }
    for(e: a) cout<<e<<' '; cout<<endl;
    for(e: b) cout<<e<<' '; cout<<endl;
}

Submission Info

Submission Time
Task B - Construct Sequences
User hogeover30
Language C++14 (GCC 5.4.1)
Score 0
Code Size 522 Byte
Status WA
Exec Time 12 ms
Memory 1024 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:24:8: warning: range-based for loop without a type-specifier only available with -std=c++1z or -std=gnu++1z
     for(e: a) cout<<e<<' '; cout<<endl;
        ^
./Main.cpp:25:8: warning: range-based for loop without a type-specifier only available with -std=c++1z or -std=gnu++1z
     for(e: b) cout<<e<<' '; cout<<endl;
        ^

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 400
Status
AC × 2
WA × 1
AC × 2
WA × 20
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 12 ms 1024 KB
006.txt WA 4 ms 384 KB
007.txt WA 11 ms 896 KB
008.txt WA 7 ms 640 KB
009.txt WA 11 ms 1024 KB
010.txt WA 12 ms 1024 KB
011.txt WA 12 ms 1024 KB
012.txt WA 12 ms 1024 KB
013.txt WA 12 ms 1024 KB
014.txt WA 12 ms 1024 KB
015.txt WA 12 ms 1024 KB
016.txt WA 12 ms 1024 KB
017.txt WA 12 ms 1024 KB
018.txt WA 12 ms 1024 KB
example0.txt AC 2 ms 256 KB
example1.txt AC 2 ms 256 KB
example2.txt WA 2 ms 256 KB