Submission #1110243

#TimeUsernameProblemLanguageResultExecution timeMemory
1110243vjudge1Ski 2 (JOI24_ski2)C++98
0 / 100
1 ms336 KiB
#include <bits/stdc++.h> using namespace std; int n; pair<long long,long long> a[305]; int b[305]; long long k; bool cmp(pair<long long,long long> a,pair<long long,long long>b) { if(a.first>b.first) return false; if(a.first<b.first) return true; return a.second>b.second; } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cin >> n >> k; for(int i=0;i<n;i++) { cin >> a[i].first >> a[i].second; b[i]=1; } sort(a,a+n); long long res=0; for(int i=1;i<n;i++) { if(a[i].first==a[0].first) { res+=k; a[i].first++; } else break; } sort(a,a+n); int mn=0; for(int i=1;i<n;i++) { if(b[mn]==0) { res+=a[mn].second; } else b[mn]--; if(a[i].first!=a[i+1].first) { if(a[mn].second>a[i].second) mn=i; } } cout << res; return 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...