Submission #774647

#TimeUsernameProblemLanguageResultExecution timeMemory
774647vjudge1Stone Arranging 2 (JOI23_ho_t1)C++17
25 / 100
2084 ms1492 KiB
#include <iostream> #include <vector> #include <utility> #include <sstream> #include <climits> #include <cstring> #define ll long long #define ld long double using namespace std; const ll mod = 1e9 + 7; typedef vector<int> vi; typedef pair<int, int> ii; typedef vector<ii> vii; void solve() { int n; cin >> n; vi color(n); for (int i = 0; i < n; i++) { cin >> color[i]; int idx = i; for (int j = i - 1; j >= 0; j--) { if (color[i] == color[j]) { idx = j; break; } } for (int j = idx; j < i; j++) { color[j] = color[i]; } } for (int i = 0; i < n; i++) { cout << color[i] << "\n"; } } int main() { // freopen("input_text", "r", stdin); // freopen("output_text", "w", stdout); // ios_base::sync_with_stdio(NULL); cin.tie(0); cout.tie(0); int t = 1; // cin >> t; while (t-- > 0) solve(); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...