Submission #383141

#TimeUsernameProblemLanguageResultExecution timeMemory
383141IwanttobreakfreeUnija (COCI17_unija)C++17
100 / 100
821 ms35328 KiB
#include <iostream> #include <vector> using namespace std; int main(){ long long int n,a,b,maxa=0,maxb=0,area=0; cin>>n; vector<int> v(5000000,0); while(n--){ cin>>a>>b; if(v[a]<b)v[a]=b; if(a>maxa)maxa=a; } int maxi=0; for(int i=maxa;i>=1;i--){ if(v[i]>maxi)maxi=v[i]; area+=maxi; } cout<<area; }

Compilation message (stderr)

unija.cpp: In function 'int main()':
unija.cpp:5:29: warning: unused variable 'maxb' [-Wunused-variable]
    5 |  long long int n,a,b,maxa=0,maxb=0,area=0;
      |                             ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...