Submission #920674

# Submission time Handle Problem Language Result Execution time Memory
920674 2024-02-02T21:57:12 Z tolbi Stone Arranging 2 (JOI23_ho_t1) C++17
100 / 100
125 ms 17332 KB
#pragma optimize("Bismillahirrahmanirrahim")
//█▀█─█──█──█▀█─█─█
//█▄█─█──█──█▄█─█■█
//█─█─█▄─█▄─█─█─█─█
//Allahuekber
//ahmet23 orz...
//Sani buyuk Osman Pasa Plevneden cikmam diyor.
//FatihSultanMehmedHan
//YavuzSultanSelimHan
//AbdulhamidHan
#define author tolbi
#include <bits/stdc++.h>
using namespace std;
template<typename X, typename Y> istream& operator>>(istream& in, pair<X,Y> &pr) {return in>>pr.first>>pr.second;}
template<typename X, typename Y> ostream& operator<<(ostream& os, pair<X,Y> pr) {return os<<pr.first<<" "<<pr.second;}
template<typename X> istream& operator>>(istream& in, vector<X> &arr) {for(auto &it : arr) in>>it; return in;}
template<typename X> ostream& operator<<(ostream& os, vector<X> arr) {for(auto &it : arr) os<<it<<" "; return os;}
template<typename X, size_t Y> istream& operator>>(istream& in, array<X,Y> &arr) {for(auto &it : arr) in>>it; return in;}
template<typename X, size_t Y> ostream& operator<<(ostream& os, array<X,Y> arr) {for(auto &it : arr) os<<it<<" "; return os;}
#define int long long
#define endl '\n'
#define vint(x) vector<int> x
#define deci(x) int x;cin>>x;
#define decstr(x) string x;cin>>x;
#define cinarr(x) for (auto &it : x) cin>>it;
#define coutarr(x) for (auto &it : x) cout<<it<<" ";cout<<endl;
#define sortarr(x) sort(x.begin(),x.end())
#define sortrarr(x) sort(x.rbegin(),x.rend())
#define det(x) cout<<"NO\0YES"+x*3<<endl;
#define INF LONG_LONG_MAX
#define rev(x) reverse(x.begin(),x.end());
#define ios ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define tol(bi) (1LL<<((int)(bi)))
const int MOD = 1e9+7;
mt19937 ayahya(chrono::high_resolution_clock().now().time_since_epoch().count());
int32_t main(){
	ios;
	int t=1;
	int tno = 0;
	if (!t) cin>>t;
	while (t-(tno++)){
		deci(n);
		vector<pair<int,int>> stk;
		set<int> st;
		for (int i = 0; i < n; ++i)
		{
			deci(x);
			if (st.find(x)==st.end()){
				stk.push_back({i,x});
				st.insert(x);
			}
			else {
				while (stk.back().second!=x){
					st.erase(stk.back().second);
					stk.pop_back();
				}
			}
		}
		int ind = 1;
		int col = stk[0].second;
		for (int i = 0; i < n; i++){
			while (ind<stk.size() && stk[ind].first<=i){
				col=stk[ind].second;
				ind++;
			}
			cout<<col<<endl;
		}
	}
}

Compilation message

Main.cpp:1: warning: ignoring '#pragma optimize ' [-Wunknown-pragmas]
    1 | #pragma optimize("Bismillahirrahmanirrahim")
      | 
Main.cpp: In function 'int32_t main()':
Main.cpp:62:14: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   62 |    while (ind<stk.size() && stk[ind].first<=i){
      |           ~~~^~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 1 ms 460 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 1 ms 604 KB Output is correct
18 Correct 1 ms 604 KB Output is correct
19 Correct 1 ms 348 KB Output is correct
20 Correct 1 ms 344 KB Output is correct
21 Correct 1 ms 344 KB Output is correct
22 Correct 1 ms 476 KB Output is correct
23 Correct 1 ms 348 KB Output is correct
24 Correct 1 ms 348 KB Output is correct
25 Correct 1 ms 344 KB Output is correct
26 Correct 1 ms 348 KB Output is correct
27 Correct 1 ms 344 KB Output is correct
28 Correct 1 ms 348 KB Output is correct
29 Correct 1 ms 348 KB Output is correct
30 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 344 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 18 ms 1084 KB Output is correct
18 Correct 18 ms 1184 KB Output is correct
19 Correct 22 ms 1112 KB Output is correct
20 Correct 21 ms 1108 KB Output is correct
21 Correct 21 ms 1116 KB Output is correct
22 Correct 21 ms 1116 KB Output is correct
23 Correct 22 ms 1112 KB Output is correct
24 Correct 22 ms 1104 KB Output is correct
25 Correct 21 ms 1116 KB Output is correct
26 Correct 21 ms 1084 KB Output is correct
27 Correct 26 ms 1116 KB Output is correct
28 Correct 22 ms 1116 KB Output is correct
29 Correct 22 ms 1116 KB Output is correct
30 Correct 18 ms 1116 KB Output is correct
31 Correct 18 ms 1112 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 1 ms 460 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 1 ms 604 KB Output is correct
18 Correct 1 ms 604 KB Output is correct
19 Correct 1 ms 348 KB Output is correct
20 Correct 1 ms 344 KB Output is correct
21 Correct 1 ms 344 KB Output is correct
22 Correct 1 ms 476 KB Output is correct
23 Correct 1 ms 348 KB Output is correct
24 Correct 1 ms 348 KB Output is correct
25 Correct 1 ms 344 KB Output is correct
26 Correct 1 ms 348 KB Output is correct
27 Correct 1 ms 344 KB Output is correct
28 Correct 1 ms 348 KB Output is correct
29 Correct 1 ms 348 KB Output is correct
30 Correct 1 ms 348 KB Output is correct
31 Correct 0 ms 348 KB Output is correct
32 Correct 0 ms 348 KB Output is correct
33 Correct 0 ms 348 KB Output is correct
34 Correct 1 ms 348 KB Output is correct
35 Correct 0 ms 348 KB Output is correct
36 Correct 0 ms 348 KB Output is correct
37 Correct 0 ms 348 KB Output is correct
38 Correct 0 ms 348 KB Output is correct
39 Correct 1 ms 344 KB Output is correct
40 Correct 0 ms 344 KB Output is correct
41 Correct 1 ms 348 KB Output is correct
42 Correct 1 ms 348 KB Output is correct
43 Correct 1 ms 348 KB Output is correct
44 Correct 0 ms 348 KB Output is correct
45 Correct 1 ms 348 KB Output is correct
46 Correct 1 ms 348 KB Output is correct
47 Correct 18 ms 1084 KB Output is correct
48 Correct 18 ms 1184 KB Output is correct
49 Correct 22 ms 1112 KB Output is correct
50 Correct 21 ms 1108 KB Output is correct
51 Correct 21 ms 1116 KB Output is correct
52 Correct 21 ms 1116 KB Output is correct
53 Correct 22 ms 1112 KB Output is correct
54 Correct 22 ms 1104 KB Output is correct
55 Correct 21 ms 1116 KB Output is correct
56 Correct 21 ms 1084 KB Output is correct
57 Correct 26 ms 1116 KB Output is correct
58 Correct 22 ms 1116 KB Output is correct
59 Correct 22 ms 1116 KB Output is correct
60 Correct 18 ms 1116 KB Output is correct
61 Correct 18 ms 1112 KB Output is correct
62 Correct 28 ms 4284 KB Output is correct
63 Correct 103 ms 9432 KB Output is correct
64 Correct 96 ms 7704 KB Output is correct
65 Correct 31 ms 3924 KB Output is correct
66 Correct 30 ms 3924 KB Output is correct
67 Correct 32 ms 4404 KB Output is correct
68 Correct 31 ms 4176 KB Output is correct
69 Correct 33 ms 4184 KB Output is correct
70 Correct 33 ms 4176 KB Output is correct
71 Correct 33 ms 4188 KB Output is correct
72 Correct 34 ms 4136 KB Output is correct
73 Correct 94 ms 10448 KB Output is correct
74 Correct 78 ms 10488 KB Output is correct
75 Correct 108 ms 17332 KB Output is correct
76 Correct 125 ms 17156 KB Output is correct
77 Correct 94 ms 16820 KB Output is correct
78 Correct 92 ms 17332 KB Output is correct