Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
3684 杨洋杰 导弹拦截问题 C++ Compile Error 0 MS 0 KB 636 2024-06-22 18:02:26

Tests(0/0):


Code:

#include <bits/stdc++.h> using namespace std; #define ll long long const int man = 1e5+10; int n, r1, r2; int a[man], l[man], h[man]; int main () { #ifndef ONLINE_JUDGE freopen("test.in", "r", stdin); freopen("test.out", "w", stdout); #endif while (scanf("%d", a+(++n)) != EOF) ; --n; l[1] = h[1] = a[1]; r1 = r2 = 1; for(int i = 2; i <= n; ++ i) { if (l[r1] >= a[i]) l[++r1] = a[i]; else *upper_bound(l+1, l+r1+1, a[i], greater<int>()) = a[i]; if (h[r2] < a[i]) h[++r2] = a[i]; else *lower_bound(h+1, h+r2+1, a[i]) = a[i]; } printf("%d\n%d",r2); return 0;


Run Info:

Main.cc: In function 'int main()':
Main.cc:19:25: warning: format '%d' expects a matching 'int' argument [-Wformat=]
     } printf("%d\n%d",r2);
                         ^
Main.cc:20:13: error: expected '}' at end of input
     return 0;
             ^