Submission #65013823
Source Code Expand
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
struct LIST {
//int data; // 要素
int num; // 要素
struct LIST* next; // 次のデータの場所(ポインタ)
};
static void swap(int* a, int* b)
{
int temp;
temp = *a;
*a = *b;
*b = temp;
}
void quick_sort(int* a, int get_left, int get_right)
{
int left = get_left, right = get_right - 1, standard = get_right;
if (left <= right)
{
while (left < right)
{
// 基準以下・以上の
while (a[left] < a[standard] && left < right)
{
left++;
}
while (a[right] > a[standard] && left < right)
{
right--;
}
if (left < right)
{
swap(&a[left], &a[right]);
left++;
right--;
}
}
if (a[left] < a[standard])
{
left += 1;
}
swap(&a[left], &a[standard]);
quick_sort(a, get_left, left - 1);
quick_sort(a, left + 1, get_right);
}
}
int binary_search(int target, int* a, int get_left, int get_right)
{
int now = (get_left + get_right) / 2;
if (a[now] == target)
{
return now;
}
else if (get_left == get_right)
{
return - 1;
}
else if (target < a[now])
{
return binary_search(target, a, get_left, now - 1);
}
else if (a[now] < target)
{
return binary_search(target, a, now + 1, get_right);
}
}
int main(void) {
int max_M = 3 * pow(10, 5);
int i, j, k;
int temp, I_count = 0, O_count = 0;
int Q;
int X[101];
scanf("%d", &Q);
for (i = 0; i < Q; i++)
{
scanf("%d", &temp);
if (temp == 1)
{
scanf("%d", &temp);
X[I_count] = temp;
I_count++;
}
else if (temp == 2)
{
printf("%d\n", X[O_count]);
O_count++;
}
}
return 0;
}
Submission Info
| Submission Time |
|
| Task |
B - Restaurant Queue |
| User |
purazuma |
| Language |
C (gcc 12.2.0) |
| Score |
200 |
| Code Size |
1758 Byte |
| Status |
AC |
| Exec Time |
1 ms |
| Memory |
1732 KiB |
Compile Error
Main.c: In function ‘main’:
Main.c:85:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
85 | scanf("%d", &Q);
| ^~~~~~~~~~~~~~~
Main.c:89:17: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
89 | scanf("%d", &temp);
| ^~~~~~~~~~~~~~~~~~
Main.c:92:25: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
92 | scanf("%d", &temp);
| ^~~~~~~~~~~~~~~~~~
Judge Result
| Set Name |
Sample |
All |
| Score / Max Score |
0 / 0 |
200 / 200 |
| Status |
|
|
| Set Name |
Test Cases |
| Sample |
00_sample_00.txt, 00_sample_01.txt |
| All |
00_sample_00.txt, 00_sample_01.txt, 01_test_00.txt, 01_test_01.txt, 01_test_02.txt, 01_test_03.txt, 01_test_04.txt, 01_test_05.txt, 01_test_06.txt, 01_test_07.txt, 01_test_08.txt, 01_test_09.txt, 01_test_10.txt, 01_test_11.txt, 01_test_12.txt, 01_test_13.txt, 01_test_14.txt, 01_test_15.txt, 01_test_16.txt, 01_test_17.txt, 01_test_18.txt, 01_test_19.txt, 01_test_20.txt, 01_test_21.txt |
| Case Name |
Status |
Exec Time |
Memory |
| 00_sample_00.txt |
AC |
1 ms |
1628 KiB |
| 00_sample_01.txt |
AC |
0 ms |
1636 KiB |
| 01_test_00.txt |
AC |
0 ms |
1592 KiB |
| 01_test_01.txt |
AC |
1 ms |
1704 KiB |
| 01_test_02.txt |
AC |
0 ms |
1688 KiB |
| 01_test_03.txt |
AC |
1 ms |
1628 KiB |
| 01_test_04.txt |
AC |
0 ms |
1592 KiB |
| 01_test_05.txt |
AC |
0 ms |
1612 KiB |
| 01_test_06.txt |
AC |
1 ms |
1640 KiB |
| 01_test_07.txt |
AC |
1 ms |
1708 KiB |
| 01_test_08.txt |
AC |
1 ms |
1552 KiB |
| 01_test_09.txt |
AC |
1 ms |
1628 KiB |
| 01_test_10.txt |
AC |
1 ms |
1732 KiB |
| 01_test_11.txt |
AC |
1 ms |
1720 KiB |
| 01_test_12.txt |
AC |
1 ms |
1708 KiB |
| 01_test_13.txt |
AC |
1 ms |
1716 KiB |
| 01_test_14.txt |
AC |
0 ms |
1728 KiB |
| 01_test_15.txt |
AC |
1 ms |
1604 KiB |
| 01_test_16.txt |
AC |
0 ms |
1572 KiB |
| 01_test_17.txt |
AC |
1 ms |
1572 KiB |
| 01_test_18.txt |
AC |
0 ms |
1624 KiB |
| 01_test_19.txt |
AC |
1 ms |
1560 KiB |
| 01_test_20.txt |
AC |
0 ms |
1528 KiB |
| 01_test_21.txt |
AC |
1 ms |
1620 KiB |