Submission #1284771

#TimeUsernameProblemLanguageResultExecution timeMemory
1284771HaanhtienGlobal Warming (CEOI18_glo)C++17
10 / 100
24 ms2728 KiB
#include<bits/stdc++.h> using namespace std; #define ll long long #define FOR(i, a, b) for(int i=(a), _b=(b); i<=_b; i++) #define FORD(i, a, b) for(int i=(a), _b=(b); i>=_b; i--) #define BIT(i, j) ((i>>j)&1) #define pb push_back #define ii pair<ll, ll> #define pii pair<ll, ii> #define all(x) x.begin(), x.end() #define fi first #define se second const ll inf = 1e18; const ll mod = 1e9+7; const ll N = 200005; const ll M = 50005; int n; ll x; ll f[N], len, a[N]; void solve() { cin >> n >> x; for (int i = 1; i <= n; i++) cin >> a[i]; for (int i = 1; i <= n; i++) { if (a[i] > f[len]) { f[++len] = a[i]; } else { int vt = lower_bound(f, f + len + 1, a[i]) - f; f[vt] = a[i]; } } cout << len; } int main(){ ios_base::sync_with_stdio(0); cin.tie(0), cout.tie(0); #define task "bseq" if(fopen(task".inp", "r")) { freopen(task".INP", "r", stdin); freopen(task".OUT", "w", stdout); } solve(); return 0; }

Compilation message (stderr)

glo.cpp: In function 'int main()':
glo.cpp:48:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   48 |         freopen(task".INP", "r", stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
glo.cpp:49:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   49 |         freopen(task".OUT", "w", stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
#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...