QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#772894 | #3388. Negative People in Da House | I_be_wanna | AC ✓ | 1ms | 3764kb | C++11 | 669b | 2024-11-22 22:41:57 | 2024-11-22 22:41:57 |
Judging History
answer
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <cstring>
#include <queue>
#include <string>
#include <map>
#include <stack>
#include <list>
#include <set>
using namespace std;
int main()
{
int t,n,x,y,cnt,in;
scanf("%d",&t);
while(t--)
{
scanf("%d",&n);
in = cnt = 0;
for(int i = 0; i < n; i++)
{
scanf("%d%d",&x,&y);
in += x;
if(in < y)
{
cnt += (y-in);
in += (y-in);
}
in -= y;
}
printf("%d\n",cnt);
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3764kb
input:
50 100 0 1000 0 1000 0 1000 0 1000 0 1000 0 1000 0 1000 0 1000 0 1000 0 1000 0 1000 0 1000 0 1000 0 1000 0 1000 0 1000 0 1000 0 1000 0 1000 0 1000 0 1000 0 1000 0 1000 0 1000 0 1000 0 1000 0 1000 0 1000 0 1000 0 1000 0 1000 0 1000 0 1000 0 1000 0 1000 0 1000 0 1000 0 1000 0 1000 0 1000 0 1000 0 1000...
output:
100000 0 1550 922 1682 4917 4326 2236 3074 620 0 1963 83 6410 5713 1049 1894 342 376 3395 0 0 4855 3775 1452 4097 974 1776 1727 0 12 1733 368 4397 799 516 0 0 154 0 1992 0 941 491 4362 4712 2628 4873 3792 495
result:
ok 50 lines
Extra Test:
score: 0
Extra Test Passed