제출 #36946

#제출 시각아이디문제언어결과실행 시간메모리
36946nickyrioMoney (IZhO17_money)C++14
45 / 100
1500 ms52788 KiB
#include <bits/stdc++.h> #define FOR(i, a, b) for (int i = a; i<= b; ++i) #define FORD(i, a, b) for (int i = a; i>=b; --i) #define REP(i, a) for (int i = 0; i<a; ++i) #define N 1001000 #define pp pair<int, int> #define bit(S, i) (((S) >> i) & 1) #define IO cin.tie(NULL);cout.tie(NULL); #define taskname "test" using namespace std; int n, a[N]; set<int> used; int main() { //freopen(taskname".inp","r",stdin); //freopen(taskname".out","w",stdout); IO; scanf("%d", &n); FOR(i, 1, n) scanf("%d", &a[i]); int start = 1; int cnt = 0; while (start <= n) { cnt++; int last = start + 1; used.insert(a[start]); int lim; if (used.upper_bound(a[start]) == used.end()) lim = 1e9; else lim = *used.upper_bound(a[start]); while (last <= n && a[last] <= lim && a[last] >= a[last - 1]) { used.insert(a[last]); last++; } start = last; } printf("%d", cnt); }

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

money.cpp: In function 'int main()':
money.cpp:18:20: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &n);
                    ^
money.cpp:19:36: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     FOR(i, 1, n) scanf("%d", &a[i]);
                                    ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...