# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
708997 |
2023-03-13T03:43:40 Z |
vjudge1 |
Baloni (COCI15_baloni) |
C++17 |
|
838 ms |
95940 KB |
#include<bits/stdc++.h>
#pragma GCC target("avx2")
#pragma GCC optimization("O3")
#pragma GCC optimization("unroll-loops")
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
#define int long long
#define ll long long
#define pb push_back
#define F first
#define S second
#define all(x) x.begin(),x.end()
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define freopen(x) freopen(x".in","r",stdin);freopen(x".out","w",stdout);
const int N = 1e6 + 5;
const int M = 3e3 + 5;
const ll mod = 1e9 + 7;
const ll inf = 1e7;
int n, h[N], id, x, ans;
set<int> st[N];
main() {
fast
cin >> n;
for(int i = 1; i <= n; i++){
cin >> h[i];
st[h[i]].insert(i);
}
for(int i = 1000000; i >= 1; i--){
while(st[i].size()){
x = i;
id = *st[i].begin();
while(x && st[x].size()){
if(st[x].lower_bound(id) == st[x].end()) break;
id = *st[x].lower_bound(id);
st[x].erase(id);
x--;
}
ans++;
}
}
cout << ans;
}
Compilation message
baloni.cpp:3: warning: ignoring '#pragma GCC optimization' [-Wunknown-pragmas]
3 | #pragma GCC optimization("O3")
|
baloni.cpp:4: warning: ignoring '#pragma GCC optimization' [-Wunknown-pragmas]
4 | #pragma GCC optimization("unroll-loops")
|
baloni.cpp:5: warning: ignoring '#pragma comment ' [-Wunknown-pragmas]
5 | #pragma comment(linker, "/stack:200000000")
|
baloni.cpp:27:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
27 | main() {
| ^~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
26 ms |
47308 KB |
Output is correct |
2 |
Correct |
30 ms |
47396 KB |
Output is correct |
3 |
Correct |
27 ms |
47432 KB |
Output is correct |
4 |
Correct |
27 ms |
47580 KB |
Output is correct |
5 |
Correct |
667 ms |
90728 KB |
Output is correct |
6 |
Correct |
838 ms |
95940 KB |
Output is correct |
7 |
Correct |
680 ms |
87464 KB |
Output is correct |
8 |
Correct |
662 ms |
86988 KB |
Output is correct |
9 |
Correct |
668 ms |
89180 KB |
Output is correct |
10 |
Correct |
721 ms |
90824 KB |
Output is correct |