제출 #889423

#제출 시각아이디문제언어결과실행 시간메모리
889423htphong0909지구 온난화 (NOI13_gw)C++17
40 / 40
250 ms17144 KiB
#include<bits/stdc++.h> using namespace std; void File() { #define file "test" freopen(file".in", "r", stdin); freopen(file".out", "w", stdout); } int arr[1000001]; int32_t main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); vector <int> ed; //File(); int n; cin >> n; for (int i = 1; i <= n; i++) { cin >> arr[i]; if (i > 1) ed.emplace_back(min(arr[i], arr[i - 1])); } sort(arr + 1, arr + 1 + n); sort(ed.begin(), ed.end()); int p = 0; int ans = 0; for (int i = 0; i < n - 1; i++) { while (p + 1 < n && arr[p + 1] <= ed[i]) p++; ans = max(ans, 2 + i - p); } cout << ans; return 0; }

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

gw.cpp: In function 'void File()':
gw.cpp:6:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
    6 |     freopen(file".in", "r", stdin);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
gw.cpp:7:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
    7 |     freopen(file".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...