Submission #138635

#TimeUsernameProblemLanguageResultExecution timeMemory
138635WongHokFong_cppSails (IOI07_sails)C++14
0 / 100
1077 ms684 KiB
#include <iostream> #include <cstdlib> using namespace std; int flagged[100001],n,h,k,height,mini,s; int main(void) { cin>>n; for (int i=1;i<=n;i++) { cin>>h>>k;height=max(h,height); for (int q=1;q<=k;q++) { mini=1; for (int j=2;j<=h;j++) { if (flagged[j]<=flagged[mini]) { mini=j; } } flagged[mini]++; } } for (int i=1;i<=height;i++) s+=(flagged[i]-1)*flagged[i]/2; cout<<s; }
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...