Submission #1608882
Source Code Expand
#include<stdio.h> #include<iostream> int main(void){ //問題で必要な変数 int X, K; int *r; int Q; int *t; int *a; //自分で作った変数 int *stock; char s[100000],w[10]; char s2[]=" "; char *tok; int gram, timer; int maxt=0; int reverser=-1; int i, j, k; // 入力データ読み込み scanf("%d", &X); scanf("%d", &K); r = new int [K]; for(i=0; i<K; i++) std::cin >> r[i]; scanf("%d", &Q); t = new int [Q]; a = new int [Q]; stock = new int [Q]; for(i=0; i<Q; i++){ scanf("%d %d", &t[i], &a[i]); if(t[i]> maxt) maxt = t[i]; } j=0; for(i=0; i<Q; i++){ if(0 == t[i]) stock[i] = a[i]; } for(timer=1; timer<=maxt; timer++){ for(i=0; i<Q; i++){ a[i] += reverser; if(a[i]<0 || a[i] > X) a[i] -= reverser; if(timer == t[i]) stock[i] = a[i]; } if(timer == r[j]){ reverser *= -1; j++; } } // 出力 //printf("-----------\n"); for(i=0; i<Q; i++){ printf("%d\n", stock[i]); } return 0; }
Submission Info
Submission Time | |
---|---|
Task | F - Sandglass |
User | shallotime |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 1226 Byte |
Status | TLE |
Exec Time | 2103 ms |
Memory | 1408 KB |
Compile Error
./Main.cpp: In function ‘int main()’: ./Main.cpp:24:20: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d", &X); ^ ./Main.cpp:25:20: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d", &K); ^ ./Main.cpp:28:20: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d", &Q); ^ ./Main.cpp:33:37: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d %d", &t[i], &a[i]); ^
Judge Result
Set Name | Sample | All | ||||||
---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 700 | ||||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | 0_000.txt, 0_001.txt, 0_002.txt |
All | 0_000.txt, 0_001.txt, 0_002.txt, 1_003.txt, 1_004.txt, 1_005.txt, 1_006.txt, 1_007.txt, 1_008.txt, 1_009.txt, 1_010.txt, 1_011.txt, 1_012.txt, 1_013.txt, 1_014.txt, 1_015.txt, 1_016.txt, 1_017.txt, 1_018.txt, 1_019.txt, 1_020.txt, 1_021.txt, 1_022.txt, 1_023.txt, 1_024.txt, 1_025.txt, 1_026.txt, 1_027.txt, 1_028.txt, 1_029.txt, 1_030.txt, 1_031.txt, 1_032.txt, 1_033.txt, 1_034.txt, 1_035.txt, 1_036.txt, 1_037.txt, 1_038.txt, 1_039.txt, 1_040.txt, 1_041.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
0_000.txt | AC | 1 ms | 256 KB |
0_001.txt | AC | 1 ms | 256 KB |
0_002.txt | AC | 1 ms | 256 KB |
1_003.txt | TLE | 2103 ms | 1408 KB |
1_004.txt | TLE | 2103 ms | 1408 KB |
1_005.txt | TLE | 2103 ms | 1408 KB |
1_006.txt | TLE | 2103 ms | 1408 KB |
1_007.txt | TLE | 2103 ms | 1408 KB |
1_008.txt | TLE | 2103 ms | 1408 KB |
1_009.txt | TLE | 2103 ms | 1408 KB |
1_010.txt | TLE | 2103 ms | 1408 KB |
1_011.txt | TLE | 2103 ms | 1408 KB |
1_012.txt | TLE | 2103 ms | 1408 KB |
1_013.txt | TLE | 2103 ms | 1408 KB |
1_014.txt | TLE | 2103 ms | 1408 KB |
1_015.txt | TLE | 2103 ms | 1408 KB |
1_016.txt | TLE | 2103 ms | 1408 KB |
1_017.txt | TLE | 2103 ms | 1408 KB |
1_018.txt | TLE | 2103 ms | 1408 KB |
1_019.txt | TLE | 2103 ms | 1408 KB |
1_020.txt | TLE | 2103 ms | 1408 KB |
1_021.txt | TLE | 2103 ms | 1408 KB |
1_022.txt | TLE | 2103 ms | 1408 KB |
1_023.txt | TLE | 2103 ms | 1408 KB |
1_024.txt | TLE | 2103 ms | 1408 KB |
1_025.txt | TLE | 2103 ms | 1408 KB |
1_026.txt | TLE | 2103 ms | 1408 KB |
1_027.txt | TLE | 2103 ms | 1408 KB |
1_028.txt | TLE | 2103 ms | 1408 KB |
1_029.txt | TLE | 2103 ms | 1408 KB |
1_030.txt | TLE | 2103 ms | 1408 KB |
1_031.txt | TLE | 2103 ms | 1408 KB |
1_032.txt | TLE | 2103 ms | 1408 KB |
1_033.txt | TLE | 2103 ms | 1024 KB |
1_034.txt | TLE | 2103 ms | 1024 KB |
1_035.txt | TLE | 2103 ms | 1408 KB |
1_036.txt | TLE | 2103 ms | 1024 KB |
1_037.txt | TLE | 2103 ms | 1024 KB |
1_038.txt | TLE | 2103 ms | 1408 KB |
1_039.txt | TLE | 2103 ms | 1024 KB |
1_040.txt | TLE | 2103 ms | 1024 KB |
1_041.txt | TLE | 2103 ms | 1408 KB |