Submission #550006

#TimeUsernameProblemLanguageResultExecution timeMemory
550006Tien_NoobGlobal Warming (CEOI18_glo)C++17
100 / 100
43 ms3808 KiB
//Make CSP great again //Vengeance #include <bits/stdc++.h> #define TASK "TESTCODE" #define Log2(x) 31 - __builtin_clz(x) using namespace std; const int N = 2e5; int dp[2][N + 1], n, x; int res = 0; void read() { cin >> n >> x; for (int i = 1; i <= n; ++ i) { int a; cin >> a; dp[0][i] = dp[1][i] = INT_MAX; int j = lower_bound(dp[1] + 1, dp[1] + i + 1, a) - dp[1]; dp[1][j] = a; res = max(res, j); j = lower_bound(dp[0] + 1, dp[0] + i + 1, a - x) - dp[0]; dp[0][j] = a - x; dp[1][j] = min(dp[1][j], dp[0][j]); } cout << res; } void solve() { } int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); if (fopen(TASK".INP", "r")) { freopen(TASK".INP", "r", stdin); //freopen(TASK".OUT", "w", stdout); } int t = 1; bool typetest = false; if (typetest) { cin >> t; } for (int __ = 1; __ <= t; ++ __) { //cout << "Case " << __ << ": "; read(); solve(); } }

Compilation message (stderr)

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