Submission #40858818
Source Code Expand
#include <bits/stdc++.h>
using namespace std;
int main() {
int N;
long T;
cin >> N >> T;
vector<int> Ct(1, -1);
vector<int> C1(1, -1);
long tmp;
long c1;
cin >> c1;
C1.push_back(0);
for (int i=1; i<N; i++) {
cin >> tmp;
if (tmp == c1) {
C1.push_back(i);
} else if (tmp == T) {
Ct.push_back(i);
}
}
bool flag = false;
long maxt = -1, max1 = -1;
int anst = -1, ans1 = -1;
int i1 = 1, it = 1;
for (int i=0; i<N; i++) {
cin >> tmp;
if (i == C1[i1]) {
if (tmp > max1) {
ans1 = C1[i1];
max1 = tmp;
}
i1++;
} else if (i == Ct[it]) {
if (tmp > maxt) {
anst = Ct[it];
maxt = tmp;
}
it++;
}
}
if (maxt > 0) {
cout << anst+1 << endl;
} else {
cout << ans1+1 << endl;
}
return 0;
}
Submission Info
| Submission Time | |
|---|---|
| Task | B - Trick Taking |
| User | albert1313 |
| Language | C++ (GCC 9.2.1) |
| Score | 200 |
| Code Size | 1075 Byte |
| Status | AC |
| Exec Time | 116 ms |
| Memory | 4308 KiB |
Compile Error
./Main.cpp: In function ‘int main()’:
./Main.cpp:30:10: warning: unused variable ‘flag’ [-Wunused-variable]
30 | bool flag = false;
| ^~~~
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 200 / 200 | ||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | example0.txt, example1.txt, example2.txt |
| All | 000.txt, 001.txt, 002.txt, 003.txt, 004.txt, 005.txt, 006.txt, 007.txt, 008.txt, 009.txt, 010.txt, 011.txt, 012.txt, 013.txt, 014.txt, 015.txt, 016.txt, 017.txt, 018.txt, 019.txt, 020.txt, 021.txt, 022.txt, 023.txt, 024.txt, 025.txt, example0.txt, example1.txt, example2.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| 000.txt | AC | 6 ms | 3452 KiB |
| 001.txt | AC | 2 ms | 3512 KiB |
| 002.txt | AC | 2 ms | 3608 KiB |
| 003.txt | AC | 2 ms | 3452 KiB |
| 004.txt | AC | 2 ms | 3460 KiB |
| 005.txt | AC | 2 ms | 3460 KiB |
| 006.txt | AC | 2 ms | 3340 KiB |
| 007.txt | AC | 2 ms | 3404 KiB |
| 008.txt | AC | 114 ms | 4176 KiB |
| 009.txt | AC | 112 ms | 4208 KiB |
| 010.txt | AC | 113 ms | 4116 KiB |
| 011.txt | AC | 112 ms | 4308 KiB |
| 012.txt | AC | 109 ms | 3508 KiB |
| 013.txt | AC | 110 ms | 3584 KiB |
| 014.txt | AC | 111 ms | 3696 KiB |
| 015.txt | AC | 116 ms | 3688 KiB |
| 016.txt | AC | 113 ms | 3692 KiB |
| 017.txt | AC | 112 ms | 4024 KiB |
| 018.txt | AC | 112 ms | 3580 KiB |
| 019.txt | AC | 112 ms | 3728 KiB |
| 020.txt | AC | 112 ms | 3728 KiB |
| 021.txt | AC | 114 ms | 4204 KiB |
| 022.txt | AC | 40 ms | 3448 KiB |
| 023.txt | AC | 30 ms | 3400 KiB |
| 024.txt | AC | 111 ms | 3520 KiB |
| 025.txt | AC | 110 ms | 3396 KiB |
| example0.txt | AC | 2 ms | 3452 KiB |
| example1.txt | AC | 2 ms | 3408 KiB |
| example2.txt | AC | 2 ms | 3456 KiB |