ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1491. Unreal Story

Why my program get WA #18 ?
Posted by WiN_uA 4 Aug 2009 15:38
#include <iostream>
using namespace std;

int main() {
unsigned long long n,a,b,c,s;
int i;
unsigned long long  x[100001];
memset(x,0,sizeof(x));
cin>>n;
for (i=1;i<=n+1;i++)
{
cin>>a>>b>>c;
x[a]=x[a]+c;
x[b+1]=x[b+1]-c;
};s=0;
for (i=1;i<=n;i++)
{
s=s+x[i];
if (i==n) cout<<s<<endl; else
cout<<s<<" ";
}
};
Re: Why my program get WA #18 ?
Posted by Bronnikov Dima 17 Feb 2022 02:22
tried to make this code faster, but seems its imposible
Re: Why my program get WA #18 ?
Posted by Bronnikov Dima 17 Feb 2022 02:44
just use vector