F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

View Compilation Error

0_0_30192500_22637.cpp:1:1414: fatal error: GCC4.9.2/x86_64-w64-mingw32/include/c++/bits/stdc++.h>usin: Invalid argument
 #include <bits/stdc++.h>using namespace std;#define fi first#define se second#define lson rt<<1,l,mid#define rson rt<<1|1,mid+1,rtypedef long long ll;typedef pair<int, int> pii;const int maxn = 1e5 + 500;int p[maxn], k[maxn], path[maxn], dp[maxn], anss[maxn], q[maxn];bool used[maxn], ins[maxn];int n;pii maxx[maxn], ans;void add(int pos, pii val){for(; pos < maxn; pos += pos & -pos) maxx[pos] = max(maxx[pos], val);}pii getmax(int pos){pii ret = {0, 0};for(; pos > 0; pos -= pos & -pos) ret = max(ret, maxx[pos]);return ret;}void work(){for(int i = 1; i <= n; i++){ins[i] = false, path[i] = 0;maxx[i] = {0, 0};}ans = {0, 0};for(int i = 1; i <= n; i++){if(used[i]) continue;pii tmp = getmax(p[i]);ans = max(ans, {tmp.first + 1, i});path[i] = tmp.second;add(p[i], {tmp.first + 1, i});}for(int u = ans.second; u; u = path[u])ins[u] = true;}int main(){//freopen("1002.in", "r", stdin);//freopen("out", "w", stdout);//clock_t s = clock();int T;scanf("%d", &T);while(T--){scanf("%d", &n);for(int i = 1; i <= n; i++) scanf("%d", p + i);for(int i = 1; i <= n; i++) scanf("%d", k + i);for(int i = 1; i <= n; i++) used[i] = false;work();int cnt = 0;for(int i = n; i >= 1; i--){used[k[i]] = true;anss[i] = ans.first;if(ins[k[i]]) work(), ++cnt;}for(int i = 1; i <= n; i++) printf("%d%c", anss[i], " \n"[i == n]);//printf("cnt = %d\n", cnt);}//clock_t e = clock();//cout << (e - s) * 1.0 / CLOCKS_PER_SEC << endl;return 0;}
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      ^
compilation terminated.


Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-11-29 12:50:36, Gzip enabled