제출 #1280753

#제출 시각아이디문제언어결과실행 시간메모리
1280753vuquangsangGlobal Warming (CEOI18_glo)C++20
38 / 100
2094 ms2780 KiB
#include <bits/stdc++.h> using namespace std; #define el "\n" #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 pb push_back #define fi first #define se second #define all(x) x.begin(),x.end() #define lg(x) __lg(x) #define alla(a,n) a+1,a+n+1 #define ll long long template <class T> bool maxi(T &x, T y) { if(x < y) { x = y ; return true ;} return false;} template <class T> bool mini(T &x, T y) { if(x > y) { x = y ; return true ;} return false;} const int N = 2e5 + 2; const int INF = 1e9 + 2; int n, a[N], lim; void inp() { cin >> n >> lim; FOR(i, 1, n) cin >> a[i]; } /* Try your best No regrets */ namespace subtask_3 { int temp[N]; void slv() { int ans = 0; for(int i = 1; i <= n; i++) { a[i] -= lim; for(int j = 1; j <= n; j++) temp[j] = INF; for(int j = 1; j <= n; j++) { int pos = lower_bound(temp + 1, temp + n + 1, a[j]) - temp; maxi(ans, pos); temp[pos] = a[j]; } } cout << ans; } } namespace subtask_4 { int temp[N], dp[N]; void slv() { FOR(i, 1, n) temp[i] = INF; int ans = 0; FOR(i, 1, n) { int pos = lower_bound(temp + 1, temp + n + 1, a[i]) - temp; dp[i] = pos; temp[pos] = a[i]; maxi(ans, pos); } cout << ans; } } namespace subtask_5 { void slv() { } } /* Code slowly, think carefully */ main() { ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); #define __Azul__ "glo" if(fopen(__Azul__".inp", "r")) { freopen(__Azul__".inp", "r", stdin); freopen(__Azul__".out", "w", stdout); } bool qs = 0; int T = 1; if(qs) cin >> T; while(T--) { inp(); if(!lim) subtask_4::slv(); else subtask_3::slv(); } cerr << "\nTime" << 0.001 * clock() << "s "; return 0; }

컴파일 시 표준 에러 (stderr) 메시지

glo.cpp:82:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   82 | main()
      | ^~~~
glo.cpp: In function 'int main()':
glo.cpp:88:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   88 |         freopen(__Azul__".inp", "r", stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
glo.cpp:89:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   89 |         freopen(__Azul__".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...