Submission #791939

# Submission time Handle Problem Language Result Execution time Memory
791939 2023-07-24T12:43:26 Z Theo830 Stone Arranging 2 (JOI23_ho_t1) C++17
100 / 100
238 ms 19896 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1e9+7;
const ll MOD = 998244353;
typedef pair<ll,ll> ii;
#define iii pair<ll,ii>
#define f(i,a,b) for(ll i = a;i < b;i++)
#define pb push_back
#define vll vector<ll>
#define F first
#define S second
#define all(x) (x).begin(), (x).end()
///I hope I will get uprating and don't make mistakes
///I will never stop programming
///sqrt(-1) Love C++
///Please don't hack me
///@TheofanisOrfanou Theo830
///Think different approaches (bs,dp,greedy,graphs,shortest paths,mst)
///Stay Calm
///Look for special cases
///Beware of overflow and array bounds
///Think the problem backwards
///Training
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    ll n;
    cin>>n;
    ll a[n];
    ll ans[n];
    map<ll,ll>mp;
    f(i,0,n){
        cin>>a[i];
        mp[a[i]] = i;
    }
    ll pos = 0;
    while(pos < n){
        f(i,pos,mp[a[pos]]+1){
            ans[i] = a[pos];
        }
        pos = mp[a[pos]] + 1;
    }
    f(i,0,n){
        cout<<ans[i]<<"\n";
    }
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 320 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 316 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 320 KB Output is correct
11 Correct 1 ms 364 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 320 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 1 ms 320 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 2 ms 420 KB Output is correct
18 Correct 2 ms 416 KB Output is correct
19 Correct 0 ms 340 KB Output is correct
20 Correct 1 ms 340 KB Output is correct
21 Correct 1 ms 340 KB Output is correct
22 Correct 1 ms 340 KB Output is correct
23 Correct 1 ms 332 KB Output is correct
24 Correct 1 ms 340 KB Output is correct
25 Correct 1 ms 340 KB Output is correct
26 Correct 1 ms 336 KB Output is correct
27 Correct 1 ms 340 KB Output is correct
28 Correct 1 ms 340 KB Output is correct
29 Correct 1 ms 340 KB Output is correct
30 Correct 1 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 316 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 312 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 0 ms 316 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 320 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 1 ms 320 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 18 ms 4084 KB Output is correct
18 Correct 19 ms 4180 KB Output is correct
19 Correct 29 ms 4168 KB Output is correct
20 Correct 20 ms 4032 KB Output is correct
21 Correct 22 ms 4172 KB Output is correct
22 Correct 19 ms 4180 KB Output is correct
23 Correct 23 ms 4300 KB Output is correct
24 Correct 19 ms 4204 KB Output is correct
25 Correct 19 ms 4228 KB Output is correct
26 Correct 19 ms 4184 KB Output is correct
27 Correct 19 ms 4212 KB Output is correct
28 Correct 20 ms 4228 KB Output is correct
29 Correct 19 ms 4264 KB Output is correct
30 Correct 19 ms 4184 KB Output is correct
31 Correct 30 ms 4212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 320 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 316 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 320 KB Output is correct
11 Correct 1 ms 364 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 320 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 1 ms 320 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 2 ms 420 KB Output is correct
18 Correct 2 ms 416 KB Output is correct
19 Correct 0 ms 340 KB Output is correct
20 Correct 1 ms 340 KB Output is correct
21 Correct 1 ms 340 KB Output is correct
22 Correct 1 ms 340 KB Output is correct
23 Correct 1 ms 332 KB Output is correct
24 Correct 1 ms 340 KB Output is correct
25 Correct 1 ms 340 KB Output is correct
26 Correct 1 ms 336 KB Output is correct
27 Correct 1 ms 340 KB Output is correct
28 Correct 1 ms 340 KB Output is correct
29 Correct 1 ms 340 KB Output is correct
30 Correct 1 ms 340 KB Output is correct
31 Correct 0 ms 316 KB Output is correct
32 Correct 1 ms 212 KB Output is correct
33 Correct 0 ms 212 KB Output is correct
34 Correct 1 ms 312 KB Output is correct
35 Correct 1 ms 384 KB Output is correct
36 Correct 1 ms 212 KB Output is correct
37 Correct 0 ms 316 KB Output is correct
38 Correct 1 ms 212 KB Output is correct
39 Correct 1 ms 320 KB Output is correct
40 Correct 1 ms 344 KB Output is correct
41 Correct 1 ms 340 KB Output is correct
42 Correct 1 ms 340 KB Output is correct
43 Correct 1 ms 340 KB Output is correct
44 Correct 1 ms 320 KB Output is correct
45 Correct 1 ms 340 KB Output is correct
46 Correct 1 ms 340 KB Output is correct
47 Correct 18 ms 4084 KB Output is correct
48 Correct 19 ms 4180 KB Output is correct
49 Correct 29 ms 4168 KB Output is correct
50 Correct 20 ms 4032 KB Output is correct
51 Correct 22 ms 4172 KB Output is correct
52 Correct 19 ms 4180 KB Output is correct
53 Correct 23 ms 4300 KB Output is correct
54 Correct 19 ms 4204 KB Output is correct
55 Correct 19 ms 4228 KB Output is correct
56 Correct 19 ms 4184 KB Output is correct
57 Correct 19 ms 4212 KB Output is correct
58 Correct 20 ms 4228 KB Output is correct
59 Correct 19 ms 4264 KB Output is correct
60 Correct 19 ms 4184 KB Output is correct
61 Correct 30 ms 4212 KB Output is correct
62 Correct 28 ms 7400 KB Output is correct
63 Correct 151 ms 19788 KB Output is correct
64 Correct 118 ms 19792 KB Output is correct
65 Correct 31 ms 7072 KB Output is correct
66 Correct 29 ms 6960 KB Output is correct
67 Correct 29 ms 7400 KB Output is correct
68 Correct 30 ms 7388 KB Output is correct
69 Correct 39 ms 7380 KB Output is correct
70 Correct 30 ms 7320 KB Output is correct
71 Correct 30 ms 7388 KB Output is correct
72 Correct 30 ms 6332 KB Output is correct
73 Correct 109 ms 13316 KB Output is correct
74 Correct 74 ms 13516 KB Output is correct
75 Correct 233 ms 19508 KB Output is correct
76 Correct 109 ms 19896 KB Output is correct
77 Correct 183 ms 19820 KB Output is correct
78 Correct 238 ms 19100 KB Output is correct