# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1088698 | 2024-09-14T19:50:32 Z | juansigler | Infinite Race (EGOI24_infiniterace2) | C++14 | 19 ms | 12636 KB |
#include <limits.h> #include <math.h> #include <stdio.h> #include <algorithm> #include <complex> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <unordered_map> #include <unordered_set> #include <utility> #include <vector> using namespace std; typedef long long int lld; typedef long double llf; typedef pair<int, int> pii; int minLaps(const vector<int> &overtakes) { int n = overtakes.size(); int ans = 0; bool iAmFirst = false; for (auto overtake : overtakes) { if (overtake == 1) { // Aka alcanzo al oponente ans += (iAmFirst ? 1 : 0); iAmFirst = true; } else { // El oponente alcanzo a Aka iAmFirst = false; } } return ans; } int main() { ios_base::sync_with_stdio(0); cin.tie(0); int n, m; cin >> n; cin >> m; vector<vector<int>> arr(n, vector<int>()); for (int i = 0; i < m; ++i) { int x; cin >> x; arr[abs(x)].push_back(x < 0 ? -1 : 1); } int ans = 0; for (int i = 1; i < n; ++i) { ans = max(ans, minLaps(arr[i])); } cout << ans << endl; return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 448 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 344 KB | Output is correct |
4 | Correct | 10 ms | 2036 KB | Output is correct |
5 | Correct | 9 ms | 2096 KB | Output is correct |
6 | Correct | 10 ms | 2008 KB | Output is correct |
7 | Correct | 10 ms | 2040 KB | Output is correct |
8 | Correct | 0 ms | 348 KB | Output is correct |
9 | Correct | 0 ms | 344 KB | Output is correct |
10 | Correct | 8 ms | 1792 KB | Output is correct |
11 | Correct | 0 ms | 348 KB | Output is correct |
12 | Correct | 8 ms | 1880 KB | Output is correct |
13 | Correct | 0 ms | 344 KB | Output is correct |
14 | Correct | 10 ms | 2008 KB | Output is correct |
15 | Correct | 0 ms | 348 KB | Output is correct |
16 | Correct | 10 ms | 1944 KB | Output is correct |
17 | Correct | 0 ms | 344 KB | Output is correct |
18 | Correct | 8 ms | 2008 KB | Output is correct |
19 | Correct | 0 ms | 344 KB | Output is correct |
20 | Correct | 1 ms | 348 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Output is correct |
2 | Correct | 7 ms | 1872 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 19 ms | 12636 KB | Output is correct |
6 | Correct | 2 ms | 4956 KB | Output is correct |
7 | Incorrect | 8 ms | 1708 KB | Output isn't correct |
8 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 1 ms | 348 KB | Output is correct |
6 | Correct | 0 ms | 348 KB | Output is correct |
7 | Correct | 0 ms | 348 KB | Output is correct |
8 | Correct | 1 ms | 348 KB | Output is correct |
9 | Correct | 1 ms | 348 KB | Output is correct |
10 | Correct | 0 ms | 348 KB | Output is correct |
11 | Incorrect | 1 ms | 348 KB | Output isn't correct |
12 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 448 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 344 KB | Output is correct |
4 | Correct | 10 ms | 2036 KB | Output is correct |
5 | Correct | 9 ms | 2096 KB | Output is correct |
6 | Correct | 10 ms | 2008 KB | Output is correct |
7 | Correct | 10 ms | 2040 KB | Output is correct |
8 | Correct | 0 ms | 348 KB | Output is correct |
9 | Correct | 0 ms | 344 KB | Output is correct |
10 | Correct | 8 ms | 1792 KB | Output is correct |
11 | Correct | 0 ms | 348 KB | Output is correct |
12 | Correct | 8 ms | 1880 KB | Output is correct |
13 | Correct | 0 ms | 344 KB | Output is correct |
14 | Correct | 10 ms | 2008 KB | Output is correct |
15 | Correct | 0 ms | 348 KB | Output is correct |
16 | Correct | 10 ms | 1944 KB | Output is correct |
17 | Correct | 0 ms | 344 KB | Output is correct |
18 | Correct | 8 ms | 2008 KB | Output is correct |
19 | Correct | 0 ms | 344 KB | Output is correct |
20 | Correct | 1 ms | 348 KB | Output is correct |
21 | Correct | 1 ms | 344 KB | Output is correct |
22 | Correct | 7 ms | 1872 KB | Output is correct |
23 | Correct | 0 ms | 348 KB | Output is correct |
24 | Correct | 0 ms | 348 KB | Output is correct |
25 | Correct | 19 ms | 12636 KB | Output is correct |
26 | Correct | 2 ms | 4956 KB | Output is correct |
27 | Incorrect | 8 ms | 1708 KB | Output isn't correct |
28 | Halted | 0 ms | 0 KB | - |