제출 #37185

#제출 시각아이디문제언어결과실행 시간메모리
37185Ulugbek_AbdimanabovMoney (IZhO17_money)C++14
0 / 100
0 ms5924 KiB
#include <iostream> #include <cstdio> #include <algorithm> #include <cmath> #include <string> #include <vector> #include <stack> #include <queue> #include <set> #include <cstring> #include <map> #include <cstdlib> #include <ctime> #include <cassert> #include <bitset> #define f first #define s second #define ll long long #define ull unsigned long long #define mp make_pair #define pb push_back #define vi vector <int> #define ld long double #define pii pair<int, int> #define y1 sda using namespace std; const int N = int(1e6) + 10, mod = int(1e9) + 7; int n, a[N]; set <int> st; set <int> :: iterator it; int main () { freopen("money.in","r", stdin); freopen("money.out","w", stdout); scanf("%d",&n); for(int i = 0; i < n; i++){ scanf("%d",&a[i]); } int i = 0, j = 0,mx ; int ans = 0; while(i < n){ j = i; it = st.upper_bound(a[i]); if(it == st.end()){ mx = mod; } else mx = *it; st.insert(a[i]); while(j + 1 < n && a[j + 1] >= a[j] && a[j + 1] <= mx){ j++; st.insert(a[j]); } i = j + 1; ans++; } printf("%d\n", ans); return 0; }

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

money.cpp: In function 'int main()':
money.cpp:35:32: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
  freopen("money.in","r", stdin);
                                ^
money.cpp:36:34: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
  freopen("money.out","w", stdout);
                                  ^
money.cpp:37:16: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d",&n);
                ^
money.cpp:39:20: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   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...