Submission #60512266
Source Code Expand
Copy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#include <bits/stdc++.h>
using namespace std;
int n;
int sum = 0;
int t,v;
int main()
{
scanf("%d",&n);
int last_t;
for(int i = 1; i <= n; i++)
{
scanf("%d %d",&t,&v);
if(i == 1) last_t = t;
sum -= t-last_t;
if(sum < 0) sum = 0;
sum += v;
last_t = t;
}
printf("%d\n",sum);
return 0;
}
Submission Info
Submission Time
2024-12-07 12:12:20
Task
A - Humidifier 1
User
cshur
Language
C++ 20 (gcc 12.2)
Score
150
Code Size
325 Byte
Status
AC
Exec Time
1 ms
Memory
3876 KB
Compile Error
Main.cpp: In function ‘int main()’:
Main.cpp:9:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
9 | scanf("%d",&n);
| ~~~~~^~~~~~~~~
Main.cpp:13:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
13 | scanf("%d %d",&t,&v);
| ~~~~~^~~~~~~~~~~~~~~
Judge Result
Set Name
Sample
All
Score / Max Score
0 / 0
150 / 150
Status
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_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
Case Name
Status
Exec Time
Memory
00_sample_00.txt
AC
1 ms
3764 KB
00_sample_01.txt
AC
1 ms
3876 KB
00_sample_02.txt
AC
1 ms
3804 KB
01_test_00.txt
AC
1 ms
3744 KB
01_test_01.txt
AC
1 ms
3620 KB
01_test_02.txt
AC
1 ms
3580 KB
01_test_03.txt
AC
1 ms
3684 KB
01_test_04.txt
AC
1 ms
3620 KB
01_test_05.txt
AC
1 ms
3676 KB
01_test_06.txt
AC
1 ms
3876 KB
01_test_07.txt
AC
1 ms
3576 KB
01_test_08.txt
AC
1 ms
3680 KB
01_test_09.txt
AC
1 ms
3760 KB
01_test_10.txt
AC
1 ms
3760 KB
01_test_11.txt
AC
1 ms
3680 KB
01_test_12.txt
AC
1 ms
3748 KB
01_test_13.txt
AC
1 ms
3676 KB
01_test_14.txt
AC
1 ms
3812 KB
01_test_15.txt
AC
1 ms
3648 KB
01_test_16.txt
AC
1 ms
3748 KB