제출 #924655

#제출 시각아이디문제언어결과실행 시간메모리
924655sleepntsheep지구 온난화 (NOI13_gw)C++17
23 / 40
195 ms20940 KiB
#include <bits/stdc++.h> using namespace std; #define N 1000005 int n, f[N], z; pair<int, int> a[N]; int main() { scanf("%d", &n); for (int i = 0; i < n; i++) scanf("%d", &a[i].first), a[i].second = i + 2; sort(a, a+n); for (int distinct = 0, i = n; i--;) { int x = a[i].second; if (!f[x-1] && !f[x+1]) distinct++; else if (f[x-1] ^ f[x+1]) ; else distinct--; f[x] = 1; z = max(z, distinct); } printf("%d\n", z); return 0; }

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

gw.cpp: In function 'int main()':
gw.cpp:11:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |     scanf("%d", &n);
      |     ~~~~~^~~~~~~~~~
gw.cpp:12:38: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |     for (int i = 0; i < n; i++) scanf("%d", &a[i].first), a[i].second = i + 2;
      |                                 ~~~~~^~~~~~~~~~~~~~~~~~~
#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...