Submission #896405

#TimeUsernameProblemLanguageResultExecution timeMemory
896405AiperiiiPinball (JOI14_pinball)C++14
11 / 100
1054 ms47392 KiB
#include <bits/stdc++.h> #define int long long #define all(x) x.begin(),x.end() #define ff first #define ss second #define pb push_back using namespace std; signed main(){ ios_base::sync_with_stdio(); cin.tie(0); int n,m; cin>>m>>n; vector <int> a(m),b(m),c(m),d(m); for(int i=0;i<m;i++){ cin>>a[i]>>b[i]>>c[i]>>d[i]; } int mn=1e18; for(int i=0;i<(1<<m);i++){ vector <int> v; int sum=0; for(int j=0;j<m;j++){ if((i & (1<<j))!=0){ v.pb(j); sum+=d[j]; } } set <int> st; for(int j=1;j<=n;j++){ int cur=j; int s=0; while(true){ bool flag=false; for(int t=s;t<v.size();t++){ int k=v[t]; if(a[k]<=cur && cur<=b[k]){ cur=c[k]; flag=true; s=t+1; break; } } if(!flag){ st.insert(cur);break; } } if(v.size()==m)cout<<"\n"; } if(st.size()==1)mn=min(mn,sum); } if(mn==1e18)cout<<-1<<"\n"; else cout<<mn<<"\n"; }

Compilation message (stderr)

pinball.cpp: In function 'int main()':
pinball.cpp:33:30: 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]
   33 |                 for(int t=s;t<v.size();t++){
      |                             ~^~~~~~~~~
pinball.cpp:46:24: warning: comparison of integer expressions of different signedness: 'std::vector<long long int>::size_type' {aka 'long unsigned int'} and 'long long int' [-Wsign-compare]
   46 |             if(v.size()==m)cout<<"\n";
      |                ~~~~~~~~^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...