Submission #506134

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
5061342022-01-11 16:50:58lucriArt Exhibition (JOI18_art)C++17
0 / 100
0 ms204 KiB
#include <iostream>
#include <algorithm>
using namespace std;
long long s,n,r,ss[500010],sd[500010],r2;
struct tablouri{long long a,b;}t[500010];
bool comp(tablouri a1,tablouri b1)
{
return a1.a<b1.a;
}
int main()
{
cin>>n;
for(int i=1;i<=n;++i)
{
cin>>t[i].a>>t[i].b;
s+=t[i].b;
}
sort(t+1,t+n+1,comp);
int j=1,i;
for(int i=1;i<=n;++i)
{
if(t[i].a==t[j].a)
t[j].b+=t[i].b;
else
{
++j;
t[j]=t[i];
}
}
n=j;
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

art.cpp: In function 'int main()':
art.cpp:19:13: warning: unused variable 'i' [-Wunused-variable]
   19 |     int j=1,i;
      |             ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...