Submission #699381

#TimeUsernameProblemLanguageResultExecution timeMemory
699381Mo7amed_HossamArt Exhibition (JOI18_art)C++17
0 / 100
1 ms212 KiB
/* * created by Mohamed hossam #### #### ## ## ## ## ## ## ##### ## ## ###### ## ## ## ## ## ## ## ####### ############## ## ## ######## ## ###### ## ## ## ####### ############## ######### ## ## ## ## ## ## ## ## ## ## ## ## ## ## ### ### ##### ## ## ## ## ## ####### ######## */ #include <bits/stdc++.h> #define ll int #define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); using namespace std; ll n; pair<ll,ll>a[5001]; ll p=-1e18; void solve(ll i,ll sum,ll max1,ll min1) { if(i==n&&max1!=-1e18&&min1!=1e18){p=max(p,sum-(max1-min1));return;}if(i>=n)return; solve(i+1,sum,max1,min1); solve(i+1,sum+a[i].second,max(max1,a[i].first),min(a[i].first,min1)); return; } int main() { fast; cin>>n; for(ll i=0; i<n; i++) { cin>>a[i].first>>a[i].second; } solve(0,0,-1e18,1e18); cout<<p; return 0; }

Compilation message (stderr)

art.cpp:17:6: warning: overflow in conversion from 'double' to 'int' changes value from '-1.0e+18' to '-2147483648' [-Woverflow]
   17 | ll p=-1e18;
      |      ^~~~~
art.cpp: In function 'int main()':
art.cpp:35:15: warning: overflow in conversion from 'double' to 'int' changes value from '-1.0e+18' to '-2147483648' [-Woverflow]
   35 |     solve(0,0,-1e18,1e18);
      |               ^~~~~
art.cpp:35:21: warning: overflow in conversion from 'double' to 'int' changes value from '1.0e+18' to '2147483647' [-Woverflow]
   35 |     solve(0,0,-1e18,1e18);
      |                     ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...