Submission #59373369
Source Code Expand
Copy
// Problem: C - Repeating// Contest: AtCoder - AtCoder Beginner Contest 378// URL: https://atcoder.jp/contests/abc378/tasks/abc378_c// Memory Limit: 1024 MB// Time Limit: 2000 ms//// Powered by CP Editor (https://cpeditor.org)#include <bits/stdc++.h>#define int long long#define eb emplace_back#define pb push_back#define endl '\n'#define rep1(i, a, b) for (int i = (a); i <= (b); i++)#define rep2(i, b, a) for (int i = (b); i >= (a); i--)using ll = long long;using ull = unsigned long long;using namespace std;
// Problem: C - Repeating // Contest: AtCoder - AtCoder Beginner Contest 378 // URL: https://atcoder.jp/contests/abc378/tasks/abc378_c // Memory Limit: 1024 MB // Time Limit: 2000 ms // // Powered by CP Editor (https://cpeditor.org) #include <bits/stdc++.h> #define int long long #define eb emplace_back #define pb push_back #define endl '\n' #define rep1(i, a, b) for (int i = (a); i <= (b); i++) #define rep2(i, b, a) for (int i = (b); i >= (a); i--) using ll = long long; using ull = unsigned long long; using namespace std; constexpr double PI = 3.14159265358979323846; constexpr ll llmax = LLONG_MAX / 2; constexpr ll llmin = LLONG_MIN / 2; template <typename T> bool chkmin(T &a, T b) { return (b < a) ? a = b, 1 : 0; } template <typename T> bool chkmax(T &a, T b) { return (b > a) ? a = b, 1 : 0; } template <typename T> void readVectorWithLength(std::vector<T> &vec, int n) { vec.resize(n); std::copy_n(std::istream_iterator<T>(std::cin), n, vec.begin()); } template <typename T> void readVectorWithComma(std::vector<T> &vec) { std::string input; std::getline(std::cin, input); std::stringstream ss(input); for (T num; ss >> num; vec.push_back(num)) { ss.ignore(1, ','); } } template <typename T> void readVectorNoLength(std::vector<T> &vec) { for (T num; std::cin >> num; vec.push_back(num)) { if (std::cin.peek() == '\n') break; } } void solve(); signed main() { std::ios::sync_with_stdio(false); std::cin.tie(nullptr); int t = 1; // cin >> t; while (t--) { solve(); } return 0; } void solve() { // int n; cin >> n; vector<int> a; readVectorWithLength(a, n); vector<int> b(n); b[0] = -1; map<int, int> mp; mp[a[0]] = 1; for (int i = 1; i < n; i++) { if (mp[a[i]] == 0) { b[i] = -1; } else { b[i] = mp[a[i]]; } mp[a[i]] = i + 1; } for (auto x : b) cout << x << " "; }
Submission Info
Submission Time | |
---|---|
Task | C - Repeating |
User | euygnauhz |
Language | C++ 20 (gcc 12.2) |
Score | 300 |
Code Size | 2155 Byte |
Status | AC |
Exec Time | 171 ms |
Memory | 18700 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 300 / 300 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | 00_sample_01.txt, 00_sample_02.txt |
All | 00_sample_01.txt, 00_sample_02.txt, 01_random_01.txt, 01_random_02.txt, 01_random_03.txt, 01_random_04.txt, 01_random_05.txt, 01_random_06.txt, 01_random_07.txt, 01_random_08.txt, 01_random_09.txt, 01_random_10.txt, 01_random_11.txt, 01_random_12.txt, 01_random_13.txt, 01_random_14.txt, 01_random_15.txt, 01_random_16.txt, 01_random_17.txt, 01_random_18.txt, 01_random_19.txt, 01_random_20.txt, 02_handmade_01.txt, 02_handmade_02.txt, 02_handmade_03.txt, 02_handmade_04.txt, 02_handmade_05.txt, 02_handmade_06.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
00_sample_01.txt | AC | 1 ms | 3488 KB |
00_sample_02.txt | AC | 1 ms | 3500 KB |
01_random_01.txt | AC | 23 ms | 6224 KB |
01_random_02.txt | AC | 23 ms | 6172 KB |
01_random_03.txt | AC | 25 ms | 6356 KB |
01_random_04.txt | AC | 25 ms | 6244 KB |
01_random_05.txt | AC | 26 ms | 6244 KB |
01_random_06.txt | AC | 26 ms | 6204 KB |
01_random_07.txt | AC | 27 ms | 6208 KB |
01_random_08.txt | AC | 27 ms | 6252 KB |
01_random_09.txt | AC | 27 ms | 6256 KB |
01_random_10.txt | AC | 27 ms | 6212 KB |
01_random_11.txt | AC | 10 ms | 4072 KB |
01_random_12.txt | AC | 32 ms | 6352 KB |
01_random_13.txt | AC | 22 ms | 5560 KB |
01_random_14.txt | AC | 31 ms | 6220 KB |
01_random_15.txt | AC | 13 ms | 4404 KB |
01_random_16.txt | AC | 78 ms | 9160 KB |
01_random_17.txt | AC | 41 ms | 6772 KB |
01_random_18.txt | AC | 78 ms | 9096 KB |
01_random_19.txt | AC | 6 ms | 4036 KB |
01_random_20.txt | AC | 79 ms | 9184 KB |
02_handmade_01.txt | AC | 2 ms | 3428 KB |
02_handmade_02.txt | AC | 24 ms | 6212 KB |
02_handmade_03.txt | AC | 169 ms | 18596 KB |
02_handmade_04.txt | AC | 171 ms | 18700 KB |
02_handmade_05.txt | AC | 165 ms | 18684 KB |
02_handmade_06.txt | AC | 166 ms | 18684 KB |