Submission #936136

#TimeUsernameProblemLanguageResultExecution timeMemory
936136KutanGlobal Warming (CEOI18_glo)C++14
0 / 100
7 ms1372 KiB
#include <bits/stdc++.h> using namespace std; #define sonic ios_base::sync_with_stdio(false);cin.tie(0); cout.tie(0) #define IO(main) if(fopen(main".inp","r")){freopen(main".inp","r",stdin);freopen(main".out","w",stdout);} #define pb push_back #define fi first #define se second #define mp make_pair #define ins insert #define pb push_back #define el cout << endl #define SZ(x) ((int)(x).size()) #define ALL(x) (x).begin(), (x).end() #define MASK(i) ((1LL)<<(i)) #define BIT(x,i) (((x)>>(i))&(1LL)) #define FOR(i, a, b) for(int (i)=(a);(i)<=(b); i++) #define FORD(i, a, b) for(int (i)=(a);(i)>=(b); i--) using ll = long long; using ull = unsigned long long; using ld = long double; using pii = pair<int, int>; using pll = pair<ll, ll>; using vi = vector<int>; using vii = vector<pii>; const int N = 50000+9; const int mod = 1e9 + 7; const int INF = 1e9 + 7; const int base = 31; const int LOG = 20; int mul(int x, int y) {return 1LL * x * y % mod;} int calPw(int x, int y) { int ans = 1; while(y) { if (y&1) ans = 1LL * ans * x % mod; x = 1LL * x * x % mod; y >>= 1; } return ans; } int d4x[4] = {1, 0, -1, 0}; int d4y[4] = {0, 1, 0, -1}; int dx[8] = {0, 1, 1, 1, 0, -1, -1, -1}; int dy[8] = {1, 1, 0, -1, -1, -1, 0, 1}; ///Author: Le Chi Thien Luong The Vinh high school 2008 long long n,k,a[N],b[N],dp[N],ds[N],t[N],m; int bin(ll x,ll l,ll r) { int res=0,m; while(l<=r) { m=(l+r)/2; if(a[b[m]]<x) { res=m; l=m+1; } else r=m-1; } return b[res]; } void Read(){ cin>>n>>m; FOR(i,1,n)cin>>a[i]; } void Solve(){ ll res,jmax; dp[1]=1;res=1;b[1]=1; for(int i=2;i<=n;i++) { jmax=bin(a[i],1,dp[res]); dp[i]=dp[jmax]+1; b[dp[i]]=i; if(dp[i]>dp[res]) res=i; } cout<<dp[res]; } int main() { sonic; // freopen("test.inp","r",stdin); // freopen("test.out","w",stdout); int TEST = 1; while(TEST--) { Read(); Solve(); } }

Compilation message (stderr)

glo.cpp: In function 'void Read()':
glo.cpp:17:30: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
   17 | #define FOR(i, a, b) for(int (i)=(a);(i)<=(b); i++)
      |                              ^
glo.cpp:74:13: note: in expansion of macro 'FOR'
   74 |             FOR(i,1,n)cin>>a[i];
      |             ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...