Submission #59592264
Source Code Expand
Copy
// Problem: D - Home Garden// Contest: AtCoder - Toyota Programming Contest 2024#11(AtCoder Beginner Contest 379)// URL: https://atcoder.jp/contests/abc379/tasks/abc379_d// 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: D - Home Garden // Contest: AtCoder - Toyota Programming Contest 2024#11(AtCoder Beginner Contest 379) // URL: https://atcoder.jp/contests/abc379/tasks/abc379_d // 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; } int Q; vector<int> pot; void solve() { // cin >> Q; while (Q--) { int type; cin >> type; if (type == 1) { pot.pb(0); } else if (type == 2) { int t; cin >> t; for (auto &x : pot) { x += t; } } else if (type == 3) { int h; cin >> h; sort(pot.begin(), pot.end()); auto it1 = lower_bound(pot.begin(), pot.end(), h); if (it1 == pot.end()) { cout << 0 << endl; } else { cout << pot.end() - it1 << endl; } pot.erase(it1, pot.end()); } } }
Submission Info
Submission Time | |
---|---|
Task | D - Home Garden |
User | euygnauhz |
Language | C++ 20 (gcc 12.2) |
Score | 400 |
Code Size | 2490 Byte |
Status | AC |
Exec Time | 18 ms |
Memory | 3616 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 400 / 400 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | 00_sample_00.txt, 00_sample_01.txt |
All | 00_sample_00.txt, 00_sample_01.txt, 01_random_00.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, 01_random_21.txt, 01_random_22.txt, 01_random_23.txt, 01_random_24.txt, 02_hand_00.txt, 02_hand_01.txt, 02_hand_02.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
00_sample_00.txt | AC | 1 ms | 3452 KB |
00_sample_01.txt | AC | 1 ms | 3520 KB |
01_random_00.txt | AC | 9 ms | 3452 KB |
01_random_01.txt | AC | 13 ms | 3468 KB |
01_random_02.txt | AC | 11 ms | 3432 KB |
01_random_03.txt | AC | 9 ms | 3424 KB |
01_random_04.txt | AC | 5 ms | 3608 KB |
01_random_05.txt | AC | 11 ms | 3336 KB |
01_random_06.txt | AC | 4 ms | 3612 KB |
01_random_07.txt | AC | 7 ms | 3464 KB |
01_random_08.txt | AC | 4 ms | 3424 KB |
01_random_09.txt | AC | 1 ms | 3400 KB |
01_random_10.txt | AC | 7 ms | 3424 KB |
01_random_11.txt | AC | 4 ms | 3616 KB |
01_random_12.txt | AC | 13 ms | 3476 KB |
01_random_13.txt | AC | 13 ms | 3356 KB |
01_random_14.txt | AC | 5 ms | 3488 KB |
01_random_15.txt | AC | 6 ms | 3420 KB |
01_random_16.txt | AC | 4 ms | 3428 KB |
01_random_17.txt | AC | 12 ms | 3480 KB |
01_random_18.txt | AC | 6 ms | 3360 KB |
01_random_19.txt | AC | 11 ms | 3396 KB |
01_random_20.txt | AC | 14 ms | 3484 KB |
01_random_21.txt | AC | 14 ms | 3532 KB |
01_random_22.txt | AC | 15 ms | 3536 KB |
01_random_23.txt | AC | 15 ms | 3536 KB |
01_random_24.txt | AC | 15 ms | 3468 KB |
02_hand_00.txt | AC | 18 ms | 3524 KB |
02_hand_01.txt | AC | 16 ms | 3468 KB |
02_hand_02.txt | AC | 17 ms | 3392 KB |