QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#326425 | #5512. Stone Arranging 2 | SUICIDEGIRL | 0 | 14ms | 3832kb | C++14 | 1.5kb | 2024-02-13 02:18:05 | 2024-02-13 02:18:05 |
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);
int n; cin >> n;
vector <int> v (n);
for (int i = 0; i < n; i++) {
cin >> v[i];
}
map <int, int> 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 <int,int> > x;
int r = n-1;
int l = mp[v[n-1]];
int aux = l;
int help = r;
x.pb({r-l, v[n-1]});
map <int,int> Mp;
Mp[v[n-1]]++;
int g = n-1;
map <int,int> 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) {
int 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
**/
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3560kb
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: 14ms
memory: 3832kb
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%