# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1055787 |
2024-08-13T05:27:04 Z |
변재우(#11070) |
Pizza Party (CCO24_day1problem2) |
C++17 |
|
313 ms |
28696 KB |
#include <bits/stdc++.h>
using namespace std;
const int Nmax=1000010;
int N, K, A[Nmax], V[Nmax], X[Nmax], Y[Nmax], I[Nmax];
set<pair<int, int>> S;
signed main() {
ios_base::sync_with_stdio(0); cin.tie(0);
cin>>N;
for(int i=1; i<=N; i++) {
int x; cin>>x, V[x]=i;
}
for(int i=1; i<=N; i++) cin>>A[i], A[i]=V[A[i]];
for(int i=1; i<=N; i++) I[A[i]]=i;
for(int i=1; i<=N; i++) if(A[i]==A[i-1]) {
cout<<-1; return 0;
}
for(int i=1; i<=N; i++) {
auto p=S.lower_bound(make_pair(A[i], 0));
if(p==S.end()) X[i]=++K, S.insert({A[i], K});
else {
X[i]=(*p).second;
S.erase(p), S.insert({A[i], X[i]});
}
Y[A[i]]=X[i];
}
cout<<K<<"\n";
for(int i=1; i<=N; i++) cout<<X[i]<<" \n"[i==N];
for(int i=1; i<=N; i++) cout<<Y[i]<<" \n"[i==N];
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
54 ms |
4180 KB |
jury uses fewer stacks: jans = 2, pans = 1061109567 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
604 KB |
flavours don't match |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
313 ms |
28696 KB |
flavours don't match |
2 |
Halted |
0 ms |
0 KB |
- |