# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
512395 | Kaguya | Po (COCI21_po) | C++17 | 60 / 70 | 1092 ms | 7108 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("O3, Ofast, unroll-loops")
#pragma GCC target("avx2")
#pragma GCC target("bmi2")
vector<int> pos[100051];
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int n;
cin >> n;
vector<int> a(n);
bool have = false;
for (auto& t : a) {
cin >> t;
if (t == 0)
have = true;
}
vector<int> ve;
for (int i = 0; i < n; i++)
ve.push_back(a[i]);
sort(ve.begin(), ve.end());
ve.resize(unique(ve.begin(), ve.end()) - ve.begin());
for (int i = 0; i < n; i++) {
a[i] = lower_bound(ve.begin(), ve.end(), a[i]) - ve.begin();
}
int ans = 0;
vector<int> se;
vector<bool> vis(n, false);
vector<bool> was(n + 11, false);
for (int i = 0; i < n; i++)
if (!was[a[i]]) {
se.push_back(a[i]);
was[a[i]] = true;
}
sort(se.rbegin(), se.rend());
for (int i = 0; i < n; i++)
pos[a[i]].push_back(i);
if (!have) {
ans += 1;
se.pop_back();
}
for (int i = 0; i < n; i++)
if (have && a[i] == 0)
vis[i] = true;
if (have && se.back() == 0)
se.pop_back();
while (!se.empty()) {
int x = se.back();
se.pop_back();
for (auto t : pos[x]) {
if (vis[t])
continue;
vis[t] = true;
int i = t;
ans += 1;
priority_queue<pair<int, int>, vector<pair<int, int>> > vs;
while (i < n && a[i] >= x) {
if (a[i] > x)
vs.push({a[i], i});
if (!vs.empty() && ((vs.top())).first < x) {
while (!vs.empty() && ((vs.top())).first < x) {
vis[((vs.top())).second] = true;
ans += 1;
vs.pop();
}
}
if (a[i] == x)
vis[i] = true;
i++;
}
if (a[i] == x)
vis[i] = true;
}
}
cout << ans << '\n';
}
컴파일 시 표준 에러 (stderr) 메시지
Main.cpp:5:47: warning: bad option '-f Ofast' to pragma 'optimize' [-Wpragmas] 5 | #pragma GCC optimize("O3, Ofast, unroll-loops") | ^ Main.cpp:5:47: warning: bad option '-f unroll-loops' to pragma 'optimize' [-Wpragmas] Main.cpp:6:26: warning: bad option '-f Ofast' to attribute 'optimize' [-Wattributes] 6 | #pragma GCC target("avx2") | ^ Main.cpp:6:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f Ofast' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f Ofast' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f Ofast' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f Ofast' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f Ofast' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f Ofast' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f Ofast' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f Ofast' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f Ofast' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f Ofast' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f Ofast' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f Ofast' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f Ofast' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f Ofast' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f Ofast' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f Ofast' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f Ofast' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f Ofast' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f Ofast' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f Ofast' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f Ofast' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f Ofast' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f Ofast' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f Ofast' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f Ofast' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f Ofast' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f Ofast' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f Ofast' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f Ofast' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f Ofast' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f Ofast' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f Ofast' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f Ofast' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f Ofast' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f Ofast' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f Ofast' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f Ofast' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f Ofast' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f Ofast' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f Ofast' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f Ofast' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f Ofast' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f Ofast' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f Ofast' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f Ofast' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f Ofast' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f Ofast' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f Ofast' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f Ofast' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f Ofast' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f Ofast' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f Ofast' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f Ofast' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f Ofast' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f Ofast' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f Ofast' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f Ofast' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f Ofast' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f Ofast' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f Ofast' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f Ofast' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f Ofast' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f Ofast' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f Ofast' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f Ofast' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f Ofast' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f Ofast' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f Ofast' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f Ofast' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f Ofast' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f Ofast' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f Ofast' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f Ofast' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f Ofast' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f Ofast' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f Ofast' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f Ofast' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f Ofast' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f Ofast' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f Ofast' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '-f unroll-loops' to attribute 'optimize' [-Wattributes] Main.cpp:6:26: warning: bad option '
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |