# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1001253 | 2024-06-18T17:29:16 Z | zh_h | Stone Arranging 2 (JOI23_ho_t1) | C++17 | 2000 ms | 34412 KB |
#include <bits/stdc++.h> #define ll long long int #define pb push_back using namespace std; int main(){ int n; cin >> n; set<int> s; vector<int> v(n+1); for(int i = 1; i <= n; i ++){ cin >> v[i]; s.insert(v[i]); } map<int, int> m; map<int, int> m2; int cur=1; for(auto i : s){ m[i] = cur; m2[cur] = i; cur++; } vector<int> ap(n+1, 0); for(int i = 1; i <= n; i ++){ auto it = m.find(v[i]); if(ap[it->second] != 0){ // cout << ap[it->second] << " " << i << endl << endl; for(int j = ap[it->second]; j <= i; j ++){ auto it2 = m.find(v[j]); ap[it2->second] = 0; v[j] = v[i]; } } ap[it->second] = i; // cout << "i: " << i << endl; // for(int i = 0; i < ap.size(); i ++){ // cout << i << ": " << ap[i] << endl; // } // cout << endl; } // for(int i = 0; i < ap.size(); i ++){ // cout << i << ": " << ap[i] << endl; // } vector<pair<int, int>> ans; for(int i = 0; i < ap.size(); i ++){ if(ap[i] != 0){ auto it = m2.find(i); ans.pb({ap[i], it->second}); } } sort(ans.begin(), ans.end()); // for(int i = 0; i < ans.size(); i ++){ // cout << ans[i].first << " " << ans[i].second << endl; // } int b4 = 0; for(int i = 0; i < ans.size(); i ++){ for(int j = 0; j < ans[i].first-b4; j ++){ cout << ans[i].second << endl; } b4 = ans[i].first; } // for(auto i : ans){ // for(int j = 0; j < i.) // } // map<int, int> m; // m[1] = 7; // m[2] = 3; // m[3] = 2; // m[4] = 5; // m[5] = 1; // auto it = m.find(3); // cout << it->first << " " << it->second; // for(int i = 1; i <= n; i ++){ // int temp; // cin >> temp; // v[i] = temp; // s.insert(temp); // // if(!ap[temp].empty()){ // // for(auto j : ap[temp]){cout << j << " ";} cout << endl; // // ap[temp].insert(i); // // } // // else{ // // for(int j = *ap[temp].begin(); j <= i; j ++){ // // // ap[temp].insert(j); //* appearance of temp should include the positions of the new "temps" // // // ap[v[j]].erase(j); //* the appearance of v[j] in position j should be erased // // v[j] = temp; //* change the value of v[j] // // cout << j << " "; // // } // // cout << endl; // // } // } // cout << endl; // for(int i = 1; i <= n; i ++){ // cout << v[i] << endl; // } //* find the first time when the number appear //* change the range into a color //! BUT how to change the other colors? //? should the finding part also use segment tree? //? so the leaves of the tree is the colors? //? how about other notes? an on/off button? //? }
Compilation message
# | 결과 | 실행 시간 | 메모리 | 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 | 0 ms | 348 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Correct | 2 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 | 0 ms | 348 KB | Output is correct |
10 | Correct | 2 ms | 348 KB | Output is correct |
11 | Correct | 2 ms | 348 KB | Output is correct |
12 | Correct | 2 ms | 424 KB | Output is correct |
13 | Correct | 2 ms | 344 KB | Output is correct |
14 | Correct | 3 ms | 344 KB | Output is correct |
15 | Correct | 3 ms | 348 KB | Output is correct |
16 | Correct | 3 ms | 604 KB | Output is correct |
17 | Correct | 3 ms | 604 KB | Output is correct |
18 | Correct | 3 ms | 856 KB | Output is correct |
19 | Correct | 2 ms | 348 KB | Output is correct |
20 | Correct | 2 ms | 348 KB | Output is correct |
21 | Correct | 2 ms | 348 KB | Output is correct |
22 | Correct | 2 ms | 348 KB | Output is correct |
23 | Correct | 2 ms | 348 KB | Output is correct |
24 | Correct | 2 ms | 348 KB | Output is correct |
25 | Correct | 3 ms | 348 KB | Output is correct |
26 | Correct | 3 ms | 348 KB | Output is correct |
27 | Correct | 2 ms | 348 KB | Output is correct |
28 | Correct | 2 ms | 436 KB | Output is correct |
29 | Correct | 3 ms | 604 KB | Output is correct |
30 | Correct | 11 ms | 608 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | 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 | 0 ms | 348 KB | Output is correct |
5 | Correct | 2 ms | 448 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 | 440 KB | Output is correct |
9 | Correct | 2 ms | 348 KB | Output is correct |
10 | Correct | 2 ms | 348 KB | Output is correct |
11 | Correct | 2 ms | 348 KB | Output is correct |
12 | Correct | 2 ms | 344 KB | Output is correct |
13 | Correct | 2 ms | 348 KB | Output is correct |
14 | Correct | 2 ms | 348 KB | Output is correct |
15 | Correct | 2 ms | 348 KB | Output is correct |
16 | Correct | 2 ms | 436 KB | Output is correct |
17 | Correct | 179 ms | 2716 KB | Output is correct |
18 | Correct | 184 ms | 2664 KB | Output is correct |
19 | Correct | 179 ms | 2640 KB | Output is correct |
20 | Correct | 179 ms | 2620 KB | Output is correct |
21 | Correct | 177 ms | 2676 KB | Output is correct |
22 | Correct | 178 ms | 2640 KB | Output is correct |
23 | Correct | 178 ms | 2644 KB | Output is correct |
24 | Correct | 199 ms | 2640 KB | Output is correct |
25 | Correct | 178 ms | 2644 KB | Output is correct |
26 | Correct | 182 ms | 2644 KB | Output is correct |
27 | Correct | 187 ms | 2644 KB | Output is correct |
28 | Correct | 188 ms | 2748 KB | Output is correct |
29 | Correct | 176 ms | 2552 KB | Output is correct |
30 | Correct | 176 ms | 2640 KB | Output is correct |
31 | Correct | 190 ms | 2640 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | 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 | 0 ms | 348 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Correct | 2 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 | 0 ms | 348 KB | Output is correct |
10 | Correct | 2 ms | 348 KB | Output is correct |
11 | Correct | 2 ms | 348 KB | Output is correct |
12 | Correct | 2 ms | 424 KB | Output is correct |
13 | Correct | 2 ms | 344 KB | Output is correct |
14 | Correct | 3 ms | 344 KB | Output is correct |
15 | Correct | 3 ms | 348 KB | Output is correct |
16 | Correct | 3 ms | 604 KB | Output is correct |
17 | Correct | 3 ms | 604 KB | Output is correct |
18 | Correct | 3 ms | 856 KB | Output is correct |
19 | Correct | 2 ms | 348 KB | Output is correct |
20 | Correct | 2 ms | 348 KB | Output is correct |
21 | Correct | 2 ms | 348 KB | Output is correct |
22 | Correct | 2 ms | 348 KB | Output is correct |
23 | Correct | 2 ms | 348 KB | Output is correct |
24 | Correct | 2 ms | 348 KB | Output is correct |
25 | Correct | 3 ms | 348 KB | Output is correct |
26 | Correct | 3 ms | 348 KB | Output is correct |
27 | Correct | 2 ms | 348 KB | Output is correct |
28 | Correct | 2 ms | 436 KB | Output is correct |
29 | Correct | 3 ms | 604 KB | Output is correct |
30 | Correct | 11 ms | 608 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 | 0 ms | 348 KB | Output is correct |
35 | Correct | 2 ms | 448 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 | 440 KB | Output is correct |
39 | Correct | 2 ms | 348 KB | Output is correct |
40 | Correct | 2 ms | 348 KB | Output is correct |
41 | Correct | 2 ms | 348 KB | Output is correct |
42 | Correct | 2 ms | 344 KB | Output is correct |
43 | Correct | 2 ms | 348 KB | Output is correct |
44 | Correct | 2 ms | 348 KB | Output is correct |
45 | Correct | 2 ms | 348 KB | Output is correct |
46 | Correct | 2 ms | 436 KB | Output is correct |
47 | Correct | 179 ms | 2716 KB | Output is correct |
48 | Correct | 184 ms | 2664 KB | Output is correct |
49 | Correct | 179 ms | 2640 KB | Output is correct |
50 | Correct | 179 ms | 2620 KB | Output is correct |
51 | Correct | 177 ms | 2676 KB | Output is correct |
52 | Correct | 178 ms | 2640 KB | Output is correct |
53 | Correct | 178 ms | 2644 KB | Output is correct |
54 | Correct | 199 ms | 2640 KB | Output is correct |
55 | Correct | 178 ms | 2644 KB | Output is correct |
56 | Correct | 182 ms | 2644 KB | Output is correct |
57 | Correct | 187 ms | 2644 KB | Output is correct |
58 | Correct | 188 ms | 2748 KB | Output is correct |
59 | Correct | 176 ms | 2552 KB | Output is correct |
60 | Correct | 176 ms | 2640 KB | Output is correct |
61 | Correct | 190 ms | 2640 KB | Output is correct |
62 | Correct | 209 ms | 5936 KB | Output is correct |
63 | Correct | 422 ms | 34256 KB | Output is correct |
64 | Correct | 427 ms | 34412 KB | Output is correct |
65 | Correct | 208 ms | 5456 KB | Output is correct |
66 | Correct | 234 ms | 5460 KB | Output is correct |
67 | Correct | 239 ms | 5720 KB | Output is correct |
68 | Correct | 220 ms | 5716 KB | Output is correct |
69 | Correct | 212 ms | 5712 KB | Output is correct |
70 | Correct | 219 ms | 5728 KB | Output is correct |
71 | Correct | 215 ms | 5712 KB | Output is correct |
72 | Correct | 228 ms | 5680 KB | Output is correct |
73 | Correct | 366 ms | 20680 KB | Output is correct |
74 | Execution timed out | 2073 ms | 18004 KB | Time limit exceeded |
75 | Halted | 0 ms | 0 KB | - |