Submission #710839

#TimeUsernameProblemLanguageResultExecution timeMemory
710839Jovan26Art Exhibition (JOI18_art)C++14
50 / 100
1099 ms45924 KiB
#include<bits/stdc++.h> using namespace std; int main(){ #define int long long int n; cin>>n; int a1[n]; int b[n]; map<int, int> mapa; for(int i=0;i<n;i++){ cin>>a1[i]>>b[i]; mapa[a1[i]]+=b[i]; } sort(a1,a1+n); vector<int> a; for(int i=0;i<n;i++){ if(i==0 || a1[i]!=a1[i-1]) a.push_back(a1[i]); } int o = 0; for(int i=0;i<a.size();i++){ //if(i!=0 && a[i]==a[i-1]) continue; int maks = a[i]; int tr = 0; for(int j=i;j>=0;j--){ tr+=mapa[a[j]]; //cerr<<tr<<" "; int zbir = tr-(maks-a[j]); if(zbir==10) cerr<<i<<" "<<j<<" "<<tr<<endl; o = max(o, zbir); } } cout<<o<<endl; }

Compilation message (stderr)

art.cpp: In function 'int main()':
art.cpp:20:15: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   20 |  for(int i=0;i<a.size();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...