QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#326426 | #5512. Stone Arranging 2 | SUICIDEGIRL | 0 | 15ms | 4668kb | C++14 | 1.5kb | 2024-02-13 02:24:46 | 2024-02-13 02:24:46 |
Judging History
answer
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define pb push_back
#define F first
#define S second
using namespace std;
//using namespace __gnu_pbds;
//typedef tree<ll, null_type, less_equal<ll>,
// rb_tree_tag, tree_order_statistics_node_update>
//TREE;
int main() {
ios_base::sync_with_stdio(0); cin.tie(0);
ll n; cin >> n;
vector <ll> v (n);
for (int i = 0; i < n; i++) {
cin >> v[i];
}
map <ll, ll> mp;
mp[v[0]] = 0;
for (int i = 1; i < n; i++) {
if (mp[v[i]] == 0 && v[i] != v[0]) {
mp[v[i]] = i;
}
}
vector <pair <ll,ll> > x;
ll r = n-1;
ll l = mp[v[n-1]];
ll aux = l;
ll help = r;
x.pb({r-l, v[n-1]});
map <ll,ll> Mp;
Mp[v[n-1]]++;
ll g = n-1;
map <ll,ll> mapa;
mapa[v[g]] = g;
for (int i = n-2; i >= 0; i--) {
r = i;
l = mp[v[i]];
if (l < aux && Mp[v[i]] == 0) {
x.pop_back();
x.pb({help - mapa[v[g]]+1, v[g]});
x.pb({r-l+1, v[i]});
aux = l;
help = r;
Mp[v[i]]++;
g =i;
}
mapa[v[i]] = i;
}
reverse (x.begin(), x.end());
for (auto c : x) {
ll to = c.F;
while (to--) {
cout << c.S << "\n";
}
}
return 0;
}
/**
1 2 !
1
1
2
2
1
2
2
1
1
2
6
1
2
1
2
3
2
**/
詳細信息
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3576kb
input:
1 1
output:
result:
wrong answer 1st lines differ - expected: '1', found: ''
Subtask #2:
score: 0
Wrong Answer
Test #29:
score: 0
Wrong Answer
time: 15ms
memory: 4668kb
input:
200000 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...
output:
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...
result:
wrong answer 200000th lines differ - expected: '1', found: ''
Subtask #3:
score: 0
Skipped
Dependency #1:
0%