QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#316530 | #8123. Eurokod | stegatxins0 | 50 ✓ | 1ms | 3868kb | C++17 | 3.4kb | 2024-01-27 21:35:22 | 2024-01-27 21:35:23 |
Judging History
answer
/* {{{
Problem: $(PROBLEM)
Contest: $(CONTEST)
Judge: $(JUDGE)
URL: $(URL)
Memory Limit: $(MEMLIM)
Time Limit: $(TIMELIM)
Start: $(DATE)
Author: stegatxins0
*/
// ↓テンプレート↓
// https://qiita.com/sorachandu/items/041169d34b9f9b99bcf7
#include <bits/stdc++.h>
using namespace std;
// ジャッジサーバーにAtCoder Libraryが導入されていないところで「atcoder/allをインクルードして!」と言うとエラーが発生するので
//#if __has_include(<atcoder/all>)
//#include <atcoder/all>
//using namespace atcoder;
//#endif
// cin cout の結びつけ解除, stdioと同期しない(入出力非同期化); cとstdの入出力を混在させるとバグるので注意
struct Fast {Fast() {std::cin.tie(0); ios::sync_with_stdio(false);}} fast;
using ull = unsigned long long;
using ll = long long;
using vi = vector<int>;
using vll = vector<long long>;
using vvi = vector<vi>;
using vvll = vector<vll>;
using vs = vector<string>;
using pii = pair<int, int>;
#define pb push_back
#define mp make_pair
#define el '\n'
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define sz(x) ((int)(x).size())
#define Yes cout << "Yes" << el
#define No cout << "No" << el
#define YES cout << "YES" << el
#define NO cout << "NO" << el
const double pi = 3.141592653589793238;
// infはint型の大きい数です。より大きく、inf+infしてもオーバーフローしない数です。
const int inf = 1073741823;
const ll infl = 1LL << 60;
const string ABC = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
const string abc = "abcdefghijklmnopqrstuvwxyz";
// https://atcoder.jp/contests/apg4b/tasks/APG4b_ah
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
#define rep(i, a, b) for (auto i = (a); i < (b); i++)
#define reps(i, a, b) for (auto i = (a); i <= (b); i++)
//#define rrep(i,x) for(int i=((int)(x)-1);i>=0;i--)
//#define rreps(i,x) for(int i=((int)(x));i>0;i--)
//配列の要素を空白区切りで出力 第二引数をtrueにすると改行区切り
template<class T> inline void printvec(const vector<T>& v, bool split_line=false) {
if(v.empty()){
cout << "This vector is empty." << el;
return;
}
for (int i = 0; i < v.size(); i++) {
if(v[i]==inf || v[i]==infl) cout << 'x' << " \n"[split_line || i+1==(int)v.size()];
else cout << v[i] << " \n"[split_line || i+1==(int)v.size()];
}
}
//4近傍、(一般的に)上右下左
const int dy[4] = {-1,0,1,0};
const int dx[4] = {0,1,0,-1};
// ↑テンプレート↑ }}}
int main() {
int n;
cin >> n;
vector<pair<int,int>> v;
vector<tuple<int,int,int>> final(n);
for(int i=1;i<=n;i++){
int x;cin>>x;
final[x-1] = {n-i+1, 0, x};
//final.pb({n-i+1, x, 0});
//mp[i] = n-x+1;
}
for(int i=1;i<=n;i++){
int x;cin>>x;
v.pb({x,i});
}
sort(all(v));
for(int i=1;i<=n;i++){
get<0>(final[v[i-1].second-1]) += i;
get<1>(final[v[i-1].second-1]) = v[i-1].first;
}
sort(final.rbegin(),final.rend());
for(int i=1;i<=n;i++){
cout << i << ". Kod";
if(get<2>(final[i-1])<10)cout << 0;
cout << get<2>(final[i-1]) << " (" << get<0>(final[i-1]) << ")" << el;
}
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 17
Accepted
Test #1:
score: 17
Accepted
time: 0ms
memory: 3620kb
input:
10 3 7 1 9 2 4 5 10 8 6 3 4 6 7 10 1 9 2 8 5
output:
1. Kod07 (18) 2. Kod03 (16) 3. Kod09 (15) 4. Kod05 (14) 5. Kod04 (12) 6. Kod01 (11) 7. Kod02 (10) 8. Kod10 (8) 9. Kod08 (4) 10. Kod06 (2)
result:
ok 10 lines
Test #2:
score: 0
Accepted
time: 0ms
memory: 3608kb
input:
10 9 3 7 4 10 1 8 2 6 5 5 8 7 6 1 4 10 3 9 2
output:
1. Kod09 (19) 2. Kod07 (18) 3. Kod03 (16) 4. Kod04 (13) 5. Kod02 (11) 6. Kod01 (10) 7. Kod10 (8) 8. Kod08 (7) 9. Kod06 (6) 10. Kod05 (2)
result:
ok 10 lines
Test #3:
score: 0
Accepted
time: 1ms
memory: 3564kb
input:
20 1 20 6 2 11 14 13 15 9 10 8 12 19 7 16 5 4 17 18 3 19 3 13 18 1 20 10 11 15 2 12 6 9 14 17 5 4 7 8 16
output:
1. Kod01 (39) 2. Kod06 (38) 3. Kod20 (35) 4. Kod15 (30) 5. Kod14 (29) 6. Kod11 (28) 7. Kod09 (27) 8. Kod13 (23) 9. Kod04 (22) 10. Kod08 (21) 11. Kod02 (20) 12. Kod07 (17) 13. Kod19 (16) 14. Kod12 (15) 15. Kod03 (14) 16. Kod10 (13) 17. Kod16 (11) 18. Kod18 (9) 19. Kod17 (7) 20. Kod05 (6)
result:
ok 20 lines
Test #4:
score: 0
Accepted
time: 0ms
memory: 3788kb
input:
20 6 2 17 15 13 9 8 3 7 10 5 4 18 20 16 12 14 19 11 1 1 19 20 18 13 15 5 17 11 9 12 2 14 6 4 7 10 3 16 8
output:
1. Kod02 (38) 2. Kod06 (35) 3. Kod03 (33) 4. Kod08 (31) 5. Kod13 (30) 6. Kod17 (28) 7. Kod04 (27) 8. Kod09 (26) 9. Kod05 (23) 10. Kod15 (21) 11. Kod10 (20) 12. Kod19 (19) 13. Kod07 (17) 14. Kod20 (15) 15. Kod11 (14) 16. Kod16 (13) 17. Kod18 (11) 18. Kod14 (10) 19. Kod12 (7) 20. Kod01 (2)
result:
ok 20 lines
Test #5:
score: 0
Accepted
time: 0ms
memory: 3512kb
input:
30 3 15 21 27 12 14 11 1 18 28 7 29 26 17 8 9 10 20 25 19 5 23 4 2 22 13 30 6 24 16 25 4 23 27 2 15 22 10 28 13 16 5 8 29 21 9 7 6 18 26 17 19 14 3 24 12 11 20 1 30
output:
1. Kod14 (54) 2. Kod03 (53) 3. Kod15 (50) 4. Kod01 (48) 5. Kod21 (45) 6. Kod09 (43) 7. Kod07 (42) 8. Kod28 (41) 9. Kod11 (40) 10. Kod20 (39) 11. Kod27 (38) 12. Kod25 (36) 13. Kod04 (35) 14. Kod30 (34) 15. Kod12 (31) 16. Kod26 (30) 17. Kod19 (29) 18. Kod18 (28) 19. Kod10 (27) 20. Kod08 (26) 21. Kod22...
result:
ok 30 lines
Test #6:
score: 0
Accepted
time: 0ms
memory: 3860kb
input:
30 20 17 12 4 26 9 29 1 19 27 16 25 14 3 13 15 21 23 18 30 11 28 22 5 8 7 24 2 6 10 24 19 9 28 10 30 8 25 15 27 2 14 22 3 4 26 21 17 29 23 16 12 20 7 6 18 13 1 11 5
output:
1. Kod04 (55) 2. Kod20 (53) 3. Kod19 (51) 4. Kod17 (50) 5. Kod01 (47) 6. Kod16 (46) 7. Kod26 (44) 8. Kod12 (42) 9. Kod09 (40) 10. Kod13 (38) 11. Kod29 (35) 12. Kod27 (34) 13. Kod23 (33) 14. Kod06 (32) 15. Kod08 (31) 16. Kod21 (30) 17. Kod18 (29) 18. Kod10 (28) 19. Kod03 (26) 20. Kod25 (25) 21. Kod02...
result:
ok 30 lines
Subtask #2:
score: 19
Accepted
Test #7:
score: 19
Accepted
time: 0ms
memory: 3624kb
input:
10 6 10 7 3 8 4 2 1 5 9 194 197 195 198 157 199 159 135 171 196
output:
1. Kod06 (20) 2. Kod10 (16) 3. Kod04 (14) 4. Kod03 (13) 5. Kod02 (12) 6. Kod07 (11) 7. Kod01 (8) 8. Kod08 (7) 9. Kod09 (5) 10. Kod05 (4)
result:
ok 10 lines
Test #8:
score: 0
Accepted
time: 0ms
memory: 3824kb
input:
10 4 1 10 2 5 3 9 7 6 8 198 197 193 192 199 194 196 191 185 195
output:
1. Kod01 (18) 2. Kod05 (16) 3. Kod02 (15) 4. Kod10 (14) 5. Kod04 (13) 6. Kod07 (10) 7. Kod03 (9) 8. Kod06 (7) 9. Kod09 (5) 10. Kod08 (3)
result:
ok 10 lines
Test #9:
score: 0
Accepted
time: 0ms
memory: 3588kb
input:
20 8 13 9 14 15 6 10 12 17 5 11 2 18 3 1 19 7 4 20 16 154 91 186 198 82 194 183 184 187 197 188 193 199 185 196 191 195 189 190 192
output:
1. Kod13 (39) 2. Kod15 (33) 3. Kod10 (32) 4. Kod06 (30) 5. Kod17 (28) 6. Kod12 (27) 7. Kod09 (26) 8. Kod08 (25) 9. Kod14 (23) 10. Kod04 (22) 11. Kod11 (19) 12. Kod18 (18) 13. Kod19 (16) 14. Kod20 (15) 15. Kod03 (14) 16. Kod16 (13) 17. Kod05 (12) 18. Kod02 (11) 19. Kod01 (9) 20. Kod07 (8)
result:
ok 20 lines
Test #10:
score: 0
Accepted
time: 0ms
memory: 3868kb
input:
20 14 12 3 9 10 2 11 5 4 16 20 18 6 17 8 7 13 19 15 1 9 182 197 195 196 189 199 187 188 198 192 172 186 190 184 191 194 181 193 185
output:
1. Kod03 (36) 2. Kod10 (35) 3. Kod14 (31) 4. Kod05 (30) 5. Kod04 (28) 6. Kod11 (27) 7. Kod09 (26) 8. Kod07 (25) 9. Kod16 (23) 10. Kod17 (22) 11. Kod12 (21) 12. Kod02 (19) 13. Kod06 (18) 14. Kod19 (17) 15. Kod20 (16) 16. Kod08 (14) 17. Kod18 (12) 18. Kod13 (11) 19. Kod15 (7) 20. Kod01 (2)
result:
ok 20 lines
Test #11:
score: 0
Accepted
time: 0ms
memory: 3632kb
input:
30 15 11 7 21 26 12 27 4 24 29 23 28 8 2 6 25 16 1 18 5 13 19 14 10 30 9 20 22 3 17 191 181 188 128 198 192 183 197 190 196 184 182 195 172 187 175 177 173 179 167 199 189 176 180 185 194 186 168 193 178
output:
1. Kod21 (57) 2. Kod26 (51) 3. Kod15 (48) 4. Kod08 (46) 5. Kod29 (45) 6. Kod11 (44) 7. Kod07 (42) 8. Kod27 (41) 9. Kod05 (40) 10. Kod06 (39) 11. Kod12 (38) 12. Kod13 (36) 13. Kod01 (35) 14. Kod10 (34) 15. Kod24 (33) 16. Kod25 (31) 17. Kod02 (29) 18. Kod23 (27) 19. Kod09 (26) 20. Kod04 (24) 21. Kod22...
result:
ok 30 lines
Test #12:
score: 0
Accepted
time: 0ms
memory: 3824kb
input:
30 22 8 4 11 9 17 29 2 21 15 30 27 23 25 12 1 16 28 24 20 10 5 13 26 6 18 14 7 19 3 185 192 165 191 171 196 189 197 180 186 172 162 104 183 179 194 199 190 188 163 187 195 193 198 131 166 143 184 182 178
output:
1. Kod08 (57) 2. Kod22 (56) 3. Kod17 (55) 4. Kod04 (50) 5. Kod02 (46) 6. Kod23 (42) 7. Kod24 (41) 8. Kod21 (40) 9. Kod16 (39) 10. Kod09 (38) 11. Kod29 (37) 12. Kod11 (36) 13. Kod06 (33) 14. Kod15 (32) 15. Kod01 (31) 16. Kod30 (30) 17. Kod28 (28) 18. Kod10 (27) 19. Kod18 (26) 20. Kod07 (23) 21. Kod27...
result:
ok 30 lines
Subtask #3:
score: 14
Accepted
Test #13:
score: 14
Accepted
time: 0ms
memory: 3868kb
input:
10 4 6 10 8 5 3 9 2 1 7 136 166 131 147 81 68 54 104 15 102
output:
1. Kod04 (19) 2. Kod02 (13) 3. Kod08 (13) 4. Kod10 (13) 5. Kod03 (12) 6. Kod06 (12) 7. Kod01 (10) 8. Kod05 (10) 9. Kod09 (5) 10. Kod07 (3)
result:
ok 10 lines
Test #14:
score: 0
Accepted
time: 0ms
memory: 3632kb
input:
20 4 13 8 15 14 11 9 5 10 16 1 6 3 19 12 2 20 7 18 17 183 157 47 18 182 28 166 52 40 169 130 139 120 6 148 188 96 105 191 84
output:
1. Kod16 (30) 2. Kod05 (30) 3. Kod15 (30) 4. Kod13 (29) 5. Kod01 (28) 6. Kod10 (28) 7. Kod19 (27) 8. Kod11 (26) 9. Kod08 (24) 10. Kod04 (22) 11. Kod02 (19) 12. Kod07 (18) 13. Kod12 (18) 14. Kod09 (18) 15. Kod14 (17) 16. Kod03 (13) 17. Kod06 (12) 18. Kod18 (11) 19. Kod20 (11) 20. Kod17 (9)
result:
ok 20 lines
Test #15:
score: 0
Accepted
time: 0ms
memory: 3556kb
input:
50 7 17 39 34 37 21 13 30 8 26 38 10 1 18 28 14 41 43 2 44 48 29 40 36 27 46 32 47 24 4 50 49 19 33 20 45 16 23 6 9 42 3 11 15 12 25 31 22 35 5 132 44 26 76 81 192 122 121 8 119 141 114 5 182 149 165 154 36 126 105 22 147 176 189 15 171 134 63 17 103 130 164 127 38 194 181 72 19 100 12 200 21 187 11...
output:
1. Kod17 (86) 2. Kod41 (84) 3. Kod26 (82) 4. Kod14 (80) 5. Kod43 (79) 6. Kod07 (78) 7. Kod36 (71) 8. Kod01 (70) 9. Kod24 (69) 10. Kod08 (69) 11. Kod39 (69) 12. Kod46 (67) 13. Kod10 (65) 14. Kod30 (65) 15. Kod32 (63) 16. Kod37 (63) 17. Kod06 (60) 18. Kod27 (59) 19. Kod34 (59) 20. Kod50 (58) 21. Kod23...
result:
ok 50 lines
Test #16:
score: 0
Accepted
time: 0ms
memory: 3824kb
input:
50 21 33 14 42 8 4 46 28 49 2 29 50 35 44 19 3 41 13 48 1 40 24 39 16 9 6 12 15 26 22 43 36 27 38 17 32 34 18 5 31 45 25 10 7 20 37 11 47 30 23 17 50 195 84 99 133 32 175 54 25 142 18 190 143 16 0 115 156 128 73 76 7 124 58 30 46 61 119 118 102 96 28 45 121 43 15 51 196 89 107 40 184 71 98 200 166 8...
output:
1. Kod42 (93) 2. Kod08 (91) 3. Kod46 (88) 4. Kod14 (88) 5. Kod03 (83) 6. Kod50 (81) 7. Kod13 (80) 8. Kod28 (77) 9. Kod48 (73) 10. Kod19 (73) 11. Kod29 (73) 12. Kod21 (73) 13. Kod04 (70) 14. Kod38 (66) 15. Kod44 (65) 16. Kod06 (63) 17. Kod49 (62) 18. Kod33 (62) 19. Kod40 (61) 20. Kod45 (60) 21. Kod18...
result:
ok 50 lines
Test #17:
score: 0
Accepted
time: 0ms
memory: 3604kb
input:
50 8 22 40 44 36 43 9 10 34 24 28 33 20 26 25 23 47 3 42 13 38 39 7 37 12 14 27 5 16 21 6 18 45 49 32 2 15 17 29 35 11 31 48 50 46 1 19 30 41 4 68 39 187 30 88 48 139 38 200 175 195 142 150 24 116 1 73 76 27 109 192 146 17 91 77 80 13 61 196 138 149 98 0 143 69 34 10 14 158 183 123 126 114 172 184 1...
output:
1. Kod09 (94) 2. Kod40 (92) 3. Kod44 (89) 4. Kod10 (86) 5. Kod22 (85) 6. Kod03 (79) 7. Kod34 (77) 8. Kod43 (71) 9. Kod13 (70) 10. Kod39 (69) 11. Kod21 (68) 12. Kod47 (65) 13. Kod24 (64) 14. Kod45 (63) 15. Kod20 (63) 16. Kod08 (62) 17. Kod29 (61) 18. Kod07 (61) 19. Kod42 (61) 20. Kod12 (60) 21. Kod11...
result:
ok 50 lines
Test #18:
score: 0
Accepted
time: 0ms
memory: 3560kb
input:
50 40 5 25 41 15 30 3 47 1 32 18 6 11 50 22 49 24 16 44 8 46 17 13 39 35 45 48 34 7 37 27 26 2 21 4 9 10 14 31 28 19 20 12 43 33 29 38 42 23 36 195 113 20 149 199 129 118 123 108 60 84 190 85 95 10 92 165 192 65 133 197 150 86 168 59 34 164 62 145 183 159 117 134 4 100 200 189 28 89 144 171 121 98 1...
output:
1. Kod05 (98) 2. Kod01 (89) 3. Kod30 (88) 4. Kod41 (87) 5. Kod18 (86) 6. Kod47 (84) 7. Kod40 (82) 8. Kod44 (74) 9. Kod24 (73) 10. Kod22 (71) 11. Kod17 (67) 12. Kod06 (66) 13. Kod21 (65) 14. Kod37 (65) 15. Kod32 (64) 16. Kod46 (60) 17. Kod27 (57) 18. Kod08 (57) 19. Kod48 (55) 20. Kod25 (55) 21. Kod12...
result:
ok 50 lines
Extra Test:
score: 0
Extra Test Passed