Submission #523701

#TimeUsernameProblemLanguageResultExecution timeMemory
523701Sanzhar23Money (IZhO17_money)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long #define pb push_back #define bug cout << "bug" << endl #define speed ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0) #define all(x) x.begin(), x.end() #define F first #define S second #define pll pair <ll, ll> #define pii pair <int, int> #define triple pair <pair <ll, ll> , ll> #define ull unsigned long long #define ld long double #define pinode pair <node*, node*> const ll INF = 9e18 + 5; const ll inf = 1e9 + 5; const ll N = 3e2 + 5; const ll shift = 2e6; const ll mod = 1e9 + 7; const ll M = 10000 + 5; const ll LOG = 21; const ll sp = 263; const ll block = 500; const double eps = 1e-10; int n, a[N], ans = 0; vector <int> cur; int main(){ speed; cin >> n; for(int i = 1; i <= n; i++) cin >> a[i]; int st = 1; cur.pb(0); cur.pb(1e6 + 1); while(st <= n){ int nw; ans++; for(int i = st; i <= n; i++){ int ok = 0; for(int j = 1; j < cur.size(); j++){ if(i != st){ if(a[i] < a[i - 1]) break; } if(a[st] >= cur[j - 1] && a[i] <= cur[j]) ok++; } if(ok >= 2){ while(1) } if(ok){ nw = i + 1; continue; } break; } vector <int> f; f.pb(0); for(int j = 1; j < cur.size(); j++){ if(a[st] >= cur[j - 1] && a[nw - 1] <= cur[j]){ for(int i = st; i <= nw - 1; i++){ f.pb(a[i]); } for(int i = j; i < cur.size(); i++){ f.pb(cur[i]); } break; } f.pb(cur[j]); } cur = f; st = nw; } cout << ans << endl; } /* %I64d %I64d */

Compilation message (stderr)

money.cpp: In function 'int main()':
money.cpp:46:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   46 |    for(int j = 1; j < cur.size(); j++){
      |                   ~~^~~~~~~~~~~~
money.cpp:56:13: error: expected primary-expression before '}' token
   56 |             }
      |             ^
money.cpp:65:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   65 |   for(int j = 1; j < cur.size(); j++){
      |                  ~~^~~~~~~~~~~~
money.cpp:70:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   70 |     for(int i = j; i < cur.size(); i++){
      |                    ~~^~~~~~~~~~~~