Submission #36642860


Source Code Expand

#include <stdio.h>

int main(void){
	int n;
	scanf("%d", &n);
	long long int a[n];
	for(int i = 0; i < n; i++){
		scanf("%lld", &a[i]);
	}
	int q;
	scanf("%d", &q);
	int query, y, x;
	int all = 0;
	int cnt = 0;
	int two[2][q];
	for(int i = 0; i < q; i++){
		scanf("%d", &query);
		switch(query){
			case 1:
				scanf("%d", &x);
				all = x;
				cnt = 0;
				break;
			case 2:
				scanf("%d %d", &y, &x);
				two[0][cnt] = y;
				two[1][cnt] = x;
				cnt++;
				// a[y-1] += x;
				break;
			case 3:
				if(all){
					for(int j = 0; j < n; j++){
						a[j] = all;
					}
					all = 0;
				}
				for(int j = 0; j < cnt; j++){
					a[two[0][j]-1] += two[1][j];
				}
				scanf("%d", &y);
				printf("%lld\n", a[y-1]);
				break;
			default:
				break;
		}
	}

	return 0;
}

Submission Info

Submission Time
Task D - All Assign Point Add
User Cebu
Language C (GCC 9.2.1)
Score 0
Code Size 818 Byte
Status WA
Exec Time 2205 ms
Memory 3184 KiB

Compile Error

./Main.c: In function ‘main’:
./Main.c:5:2: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
    5 |  scanf("%d", &n);
      |  ^~~~~~~~~~~~~~~
./Main.c:8:3: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
    8 |   scanf("%lld", &a[i]);
      |   ^~~~~~~~~~~~~~~~~~~~
./Main.c:11:2: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
   11 |  scanf("%d", &q);
      |  ^~~~~~~~~~~~~~~
./Main.c:17:3: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
   17 |   scanf("%d", &query);
      |   ^~~~~~~~~~~~~~~~~~~
./Main.c:20:5: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
   20 |     scanf("%d", &x);
      |     ^~~~~~~~~~~~~~~
./Main.c:25:5: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
   25 |     scanf("%d %d", &y, &x);
      |     ^~~~~~~~~~~~~~~~~~~~~~
./Main.c:41:5: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
   41 |     scanf("%d", &y);
      |     ^~~~~~~~~~~~~~~

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 400
Status
AC × 2
WA × 1
AC × 2
WA × 11
TLE × 2
Set Name Test Cases
Sample 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt
All 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 01_N_small_03.txt, 01_N_small_04.txt, 01_N_small_05.txt, 01_N_small_06.txt, 02_random_07.txt, 02_random_08.txt, 02_random_09.txt, 02_random_10.txt, 03_max_11.txt, 04_handmade_12.txt, 04_handmade_13.txt, 04_handmade_14.txt
Case Name Status Exec Time Memory
00_sample_00.txt AC 7 ms 1664 KiB
00_sample_01.txt AC 2 ms 1640 KiB
00_sample_02.txt WA 1 ms 1656 KiB
01_N_small_03.txt WA 51 ms 1624 KiB
01_N_small_04.txt WA 46 ms 1664 KiB
01_N_small_05.txt WA 51 ms 1704 KiB
01_N_small_06.txt WA 53 ms 1964 KiB
02_random_07.txt WA 934 ms 2432 KiB
02_random_08.txt WA 770 ms 2912 KiB
02_random_09.txt WA 203 ms 2404 KiB
02_random_10.txt WA 624 ms 2764 KiB
03_max_11.txt WA 1149 ms 3184 KiB
04_handmade_12.txt TLE 2205 ms 3168 KiB
04_handmade_13.txt WA 1535 ms 2476 KiB
04_handmade_14.txt TLE 2205 ms 3136 KiB