제출 #1195561

#제출 시각아이디문제언어결과실행 시간메모리
1195561raphaelpMensza (COI22_mensza)C++20
0 / 100
5122 ms241728 KiB
#include <bits/stdc++.h> using namespace std; int main() { cin.tie(0); cout.tie(0); ios::sync_with_stdio(0); int L; cin >> L; int Q; cin >> Q; for (int j = 0; j < Q; j++) { string typ; cin >> typ; if (typ[0] != 'a' && typ[0] != 'b' && typ[0] != 'c' && j == 0) { while (true) cout << 1; } vector<int> ans; if (typ[0] == 'a') { int A; cin >> A; if (A == 1000) { for (int i = 0; i < 60; i++) ans.push_back(1); } else { for (int i = 0; i < 30; i++) ans.push_back(2); for (int i = 0; i < 50; i++) ans.push_back(3); for (int i = 0; i < (A % 10); i++) ans.push_back(1); A /= 10; for (int i = 0; i < (A % 10); i++) ans.push_back(2); A /= 10; for (int i = 0; i < (A % 10); i++) ans.push_back(3); } } if (typ[0] == 'b') { int A; cin >> A; if (A == 1000) { for (int i = 0; i < 70; i++) ans.push_back(4); } else { for (int i = 0; i < 10; i++) ans.push_back(4); for (int i = 0; i < 20; i++) ans.push_back(5); for (int i = 0; i < 40; i++) ans.push_back(6); for (int i = 0; i < (A % 10); i++) ans.push_back(4); A /= 10; for (int i = 0; i < (A % 10); i++) ans.push_back(5); A /= 10; for (int i = 0; i < (A % 10); i++) ans.push_back(6); } } if (typ[0] == 'c') { int nb; cin >> nb; vector<int> Tab(nb); for (int i = 0; i < nb; i++) cin >> Tab[i]; int A = 0, B = 0; for (int i = 0; i < nb; i++) { if (Tab[i] < 10) A += Tab[i]; else if (Tab[i] < 20) B += Tab[i] - 10; else if (Tab[i] < 30) B += 10 * (Tab[i] - 20); else if (Tab[i] < 40) A += 10 * (Tab[i] - 30); else if (Tab[i] < 50) B += 100 * (Tab[i] - 40); else if (Tab[i] < 60) A += 100 * (Tab[i] - 50); else if (Tab[i] == 60) A += 1000; else if (Tab[i] == 70) B += 1000; } if (A > B) cout << "A" << '\n'; else cout << "B" << '\n'; } else { cout << ans.size() << ' '; for (int i = 0; i < ans.size() - 1; i++) cout << ans[i] << ' '; cout << ans.back(); cout << '\n'; } } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...