# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
173046 | 2020-01-03T08:17:35 Z | tourist | Money (IZhO17_money) | C++14 | 2 ms | 256 KB |
#include <iostream> #include <vector> using namespace std; #define ll long long #define sz(x) (int)x.size() #define pii pair < int, int > #define endl "\n" #define METH ios::sync_with_stdio(0); cin.tie(0); #define BEGIN cout << "BEGIN" << endl; #define END cout << "END" << endl; const int mod = 1e9 + 7; /// ANOTHER HASH MOD: 228228227 const int prime = 29; /// ANOTHER HASH PRIME: 997 const int INF = ((long long) 0xCAFEBABE - 1e9 - 4e8); int n; vector < int > v, nw; inline void read() { v.push_back(0); scanf("%d", &n); for (int i = 1; i <= n; i++) { int a; scanf("%d", &a); v.push_back(a); } } bool sorted(int l, int r) { for (int i = l; i < r; i++) { if (v[i] > v[i + 1]) { return false; } } return true; } int check(int l, int r) { if (sorted(l, r)) { if (nw.size() == 0) { return 0; } if (nw.size() == 1) { if (v[l] >= nw[0]) { return 0; } else { return -1; } } for (int i = 1; i < nw.size(); i++) { if (nw[i - 1] <= v[l] && v[r] <= nw[i]) { return (i - 1); } } if (v[r] <= nw[0]) { return -1; } if (nw.back() <= v[l]) { return nw.size(); } } return -2; } void put(int l, int r, int place) { vector < int > temp; for (int i = 0; i <= place && i < nw.size(); i++) { temp.push_back(nw[i]); } for (int i = l; i <= r; i++) { temp.push_back(v[i]); } for (int i = place + 1; i < nw.size(); i++) { temp.push_back(nw[i]); } nw = temp; } inline void solve() { int l = 1, ans = 0; for (int r = 1; r <= n; r++) { if (v[r] > v[r + 1]) { ans++; } } cout << ans << endl; } int main() { int t = 1; //scanf("%d", &t); //precalc(); while (t--) { //purify(); read(); solve(); } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Incorrect | 2 ms | 256 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Incorrect | 2 ms | 256 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Incorrect | 2 ms | 256 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Incorrect | 2 ms | 256 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |