Submission #1077685
Source Code Expand
#include <set> #include <map> #include <queue> #include <ctime> #include <cmath> #include <cstdio> #include <vector> #include <string> #include <cctype> #include <bitset> #include <cstring> #include <cstdlib> #include <utility> #include <iostream> #include <algorithm> #define REP(i,a,b) for(int i=(a);i<=(b);i++) #define PER(i,a,b) for(int i=(a);i>=(b);i--) #define RVC(i,S) for(int i=0;i<(S).size();i++) #define RAL(i,u) for(int i=fr[u];i!=-1;i=e[i].next) using namespace std; typedef long long LL; typedef pair<int,int> pii; template<class T> inline void read(T& num) { bool start=false,neg=false; char c; num=0; while((c=getchar())!=EOF) { if(c=='-') start=neg=true; else if(c>='0' && c<='9') { start=true; num=num*10+c-'0'; } else if(start) break; } if(neg) num=-num; } /*============ Header Template ============*/ const int maxn=(int)(1e5)+5; int a[maxn],vi[maxn]; struct node { int x,v; } p[maxn]; inline bool operator < (node a,node b) { return a.v!=b.v?a.v<b.v:a.x<b.x; } int main() { int n; read(n); REP(i,1,n) { read(p[i].v);p[i].x=i; } sort(p+1,p+n+1); int now=1; REP(i,1,n) { int c=p[i].x; REP(j,1,p[i].x-1) { while(now<p[i].v && vi[now]) now++; if(now>=p[i].v || vi[now]) { printf("No\n");return 0; } a[now]=c;vi[now]=1;now++; } a[p[i].v]=c;vi[p[i].v]=1; } now=n*n; PER(i,n,1) { int c=p[i].x; REP(j,1,n-p[i].x) { while(now>p[i].v && vi[now]) now--; if(now<=p[i].v || vi[now]) { printf("No\n");return 0; } a[now]=c;vi[now]=1;now--; } } printf("Yes\n"); REP(i,1,n*n) printf("%d ",a[i]);putchar('\n'); return 0; }
Submission Info
Submission Time | |
---|---|
Task | D - K-th K |
User | frank_c1 |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 1741 Byte |
Status | WA |
Exec Time | 115 ms |
Memory | 1408 KB |
Judge Result
Set Name | Sample | All | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 800 | ||||||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | 0_00.txt, 0_01.txt |
All | 0_00.txt, 0_01.txt, 1_00.txt, 1_01.txt, 1_02.txt, 1_03.txt, 1_04.txt, 1_05.txt, 1_06.txt, 1_07.txt, 1_08.txt, 1_09.txt, 1_10.txt, 1_11.txt, 1_12.txt, 1_13.txt, 1_14.txt, 1_15.txt, 1_16.txt, 1_17.txt, 1_18.txt, 1_19.txt, 1_20.txt, 1_21.txt, 1_22.txt, 1_23.txt, 1_24.txt, 1_25.txt, 1_26.txt, 1_27.txt, 1_28.txt, 1_29.txt, 1_30.txt, 1_31.txt, 1_32.txt, 1_33.txt, 1_34.txt, 1_35.txt, 1_36.txt, 1_37.txt, 1_38.txt, 1_39.txt, 1_40.txt, 1_41.txt, 1_42.txt, 1_43.txt, 1_44.txt, 1_45.txt, 1_46.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
0_00.txt | AC | 3 ms | 256 KB |
0_01.txt | AC | 3 ms | 256 KB |
1_00.txt | AC | 3 ms | 256 KB |
1_01.txt | WA | 4 ms | 1024 KB |
1_02.txt | RE | 112 ms | 256 KB |
1_03.txt | RE | 115 ms | 512 KB |
1_04.txt | RE | 113 ms | 256 KB |
1_05.txt | WA | 4 ms | 1024 KB |
1_06.txt | RE | 113 ms | 256 KB |
1_07.txt | RE | 113 ms | 1024 KB |
1_08.txt | RE | 111 ms | 256 KB |
1_09.txt | AC | 3 ms | 256 KB |
1_10.txt | RE | 114 ms | 256 KB |
1_11.txt | AC | 3 ms | 256 KB |
1_12.txt | AC | 3 ms | 256 KB |
1_13.txt | RE | 112 ms | 256 KB |
1_14.txt | AC | 3 ms | 256 KB |
1_15.txt | RE | 112 ms | 768 KB |
1_16.txt | AC | 3 ms | 512 KB |
1_17.txt | RE | 112 ms | 640 KB |
1_18.txt | RE | 113 ms | 1024 KB |
1_19.txt | RE | 112 ms | 512 KB |
1_20.txt | RE | 111 ms | 384 KB |
1_21.txt | RE | 113 ms | 512 KB |
1_22.txt | RE | 112 ms | 768 KB |
1_23.txt | RE | 114 ms | 384 KB |
1_24.txt | RE | 112 ms | 256 KB |
1_25.txt | RE | 112 ms | 384 KB |
1_26.txt | RE | 112 ms | 256 KB |
1_27.txt | RE | 112 ms | 512 KB |
1_28.txt | AC | 3 ms | 512 KB |
1_29.txt | RE | 114 ms | 384 KB |
1_30.txt | RE | 112 ms | 768 KB |
1_31.txt | RE | 113 ms | 640 KB |
1_32.txt | AC | 3 ms | 384 KB |
1_33.txt | WA | 4 ms | 1024 KB |
1_34.txt | AC | 3 ms | 384 KB |
1_35.txt | RE | 114 ms | 512 KB |
1_36.txt | RE | 114 ms | 896 KB |
1_37.txt | RE | 112 ms | 640 KB |
1_38.txt | RE | 114 ms | 1024 KB |
1_39.txt | AC | 3 ms | 384 KB |
1_40.txt | AC | 12 ms | 1408 KB |
1_41.txt | RE | 112 ms | 256 KB |
1_42.txt | RE | 112 ms | 512 KB |
1_43.txt | RE | 114 ms | 1024 KB |
1_44.txt | AC | 3 ms | 256 KB |
1_45.txt | AC | 3 ms | 256 KB |
1_46.txt | AC | 3 ms | 640 KB |