Submission #774708

#TimeUsernameProblemLanguageResultExecution timeMemory
774708vjudge1Stone Arranging 2 (JOI23_ho_t1)C++17
100 / 100
176 ms16488 KiB
// #pragma GCC optimize("Ofast,unroll-loops") #ifdef MINHDEPTRAI #include "/Library/Developer/CommandLineTools/usr/include/c++/v1/bits/stdc++.h" #include <chrono> #define __gcd(a, b) gcd(a, b) using namespace std ::chrono; #else #include <bits/stdc++.h> #endif using namespace std; #define foru(i, a, b) for (int i = a; i <= b; ++i) #define ford(i, a, b) for (int i = a; i >= b; --i) #define IOS ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); #define mp(a, b) make_pair(a, b) // #define int long long typedef pair<int, int> pii; typedef pair<pair<int, int>, int> piii; #define endl '\n' const string name_minh = "9"; #define int long long const int maxN = 2e5 + 5; const int mod = 1; const int inf = 1e9; int n, arr[maxN]; map<int, int> cnt; map<int, int> :: iterator it; void solve(){ cin >> n; foru(i, 1, n){ cin >> arr[i]; cnt[arr[i]] = i; } int i = 1; while(i <= n){ it = cnt.find(arr[i]); int r = it -> second; if(i > r){ i++; continue; } foru(k, i, r){ arr[k] = arr[i]; } i = r + 1; } foru(i, 1, n) cout << arr[i] << " "; return; } signed main(){ IOS // #ifdef MINHDEPTRAI // ifstream cin(name_minh + ".in"); // ofstream cout(name_minh + ".out"); // #endif solve(); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...