# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
386955 |
2021-04-07T16:45:43 Z |
peijar |
Sails (IOI07_sails) |
C++17 |
|
27 ms |
2968 KB |
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int MAX = 1e5+1;
int nbAHauteur[MAX];
int nbPeutSurHauteur[MAX];
signed main(void)
{
ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
int nbPoteaux;
cin >> nbPoteaux;
int nbRestants(0);
for (int iPoteau = 0; iPoteau < nbPoteaux; ++iPoteau)
{
int hauteur, aMettre;
cin >> hauteur >> aMettre;
nbAHauteur[hauteur]++;
nbRestants += aMettre;
nbPeutSurHauteur[hauteur] += aMettre;
}
int sol(0);
int nbPoteauxDispo = 0;
int nbDrapeauxDispo = 0;
for (int iHauteur(MAX-1); iHauteur; --iHauteur)
{
nbPoteauxDispo += nbAHauteur[iHauteur];
nbDrapeauxDispo += nbPeutSurHauteur[iHauteur];
int moy = (nbRestants + iHauteur - 1) / iHauteur;
int placeEtage = min({moy, nbPoteauxDispo, nbDrapeauxDispo});
nbDrapeauxDispo -= placeEtage;
nbRestants -= placeEtage;
sol += placeEtage * (placeEtage - 1) / 2;
}
cout << sol << endl;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
364 KB |
Output is correct |
2 |
Correct |
2 ms |
364 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
364 KB |
Output is correct |
2 |
Correct |
2 ms |
364 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
364 KB |
Output is correct |
2 |
Correct |
2 ms |
364 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
364 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
364 KB |
Output is correct |
2 |
Correct |
3 ms |
1772 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
748 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
8 ms |
1132 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
13 ms |
1772 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
17 ms |
1460 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
25 ms |
2968 KB |
Output is correct |
2 |
Correct |
16 ms |
1132 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
27 ms |
2924 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |