Submission #1175309

#TimeUsernameProblemLanguageResultExecution timeMemory
1175309baqqon_Stone Arranging 2 (JOI23_ho_t1)C++20
25 / 100
2095 ms1932 KiB
/** III U U N N DDDD EEEEE RRRR SSSS TTTTT AAAAA N N DDDD I TTTTT N N OOO W W I U U NN N D D E R R S T A A NN N D D I T NN N O O W W I U U N N N D D EEEE RRRR SSSS T AAAAA N N N D D I T N N N O O W W W I U U N NN D D E R R S T A A N NN D D I T N NN O O WW WW III UUUUU N N DDDD EEEEE R R SSSS T A A N N DDDD I T N N OOO W W **/ #include <bits/stdc++.h> using namespace std; #define ent '\n' #define F first #define S second #define in insert #define no "NO\n" #define yes "YES\n" #define pb push_back #define sz(w) w.size() #define int long long #define all(w) w.begin(), w.end() #define BakTR ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); const int MOD = 998244353, N = 2e5 + 7 , inf = 1e9 + 7, INF = 2e18, LOG = 20 , mod = 1e6 + 7 ; void justdoit(int l , int r , int p , int a[]) { for(int i = l ; i <= r ; i++) { a[i] = p ; } } void accepted() { int n ; cin >> n ; int a[n + 1] ; for(int i = 1 ; i <= n ; i++) { cin >> a[i] ; } map <int , int> cnt ; for(int i = 1; i <= n ; i++) { int cur = cnt.size() ; cnt[a[i]]++; if(cur < cnt.size()) { for(int j = n ; j >= 1 ; j--) { if(a[j] == a[i] && i != j) { justdoit(i , j , a[i] , a) ; } } } } for(int i = 1 ; i <= n ; i++) { cout << a[i] << ent ; } } signed main() { BakTR //PLS NeverGiveUp //freopen("input.txt", "r", stdin) ; //freopen("output.txt", "w", stdout) ; int T = 1 ; //cin >> T ; while (T--) { accepted(); cout << ent; } } /** baktr 65868073990A98C52AFDB7A48F4E8D26 **/
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...