-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c1b0f19
commit 9380948
Showing
5 changed files
with
47 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#include <cstdio> | ||
#include <iostream> | ||
#include <cstring> | ||
|
||
int N, K, numbers[100005]; | ||
int cntr[100005]; | ||
|
||
int answer; | ||
/** | ||
* AIO 2023 | ||
* @link https://orac2.info/problem/aio23raffle/ | ||
* | ||
* @mrmagic2020 | ||
*/ | ||
int main(void) { | ||
memset(cntr, 0, sizeof(cntr)); | ||
|
||
FILE *input_file = fopen("rafflein.txt", "r"); | ||
FILE *output_file = fopen("raffleout.txt", "w"); | ||
|
||
fscanf(input_file, "%d%d", &N, &K); | ||
for (int i = 0; i < N; i++) { | ||
fscanf(input_file, "%d", &numbers[i]); | ||
cntr[numbers[i]]++; | ||
std::cout << "cntr[" << numbers[i] << "] = " << cntr[numbers[i]] << std::endl; | ||
} | ||
|
||
int min = -1; | ||
for (int i = 1; i <= K; i++) | ||
if (cntr[i] == 1) | ||
{ | ||
min = i; | ||
break; | ||
} | ||
|
||
answer = min; | ||
|
||
fprintf(output_file, "%d\n", answer); | ||
|
||
fclose(input_file); | ||
fclose(output_file); | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
7 8 | ||
3 5 5 6 3 5 6 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
-1 |
Binary file not shown.