Submission #599042

# Submission time Handle Problem Language Result Execution time Memory
599042 2022-07-19T09:27:05 Z almothana05 Potatoes and fertilizers (LMIO19_bulves) C++14
0 / 100
10 ms 2188 KB
#include<bits/stdc++.h>
#define mod 1000000007
using namespace std;
vector<vector<int> >cmp;
vector<int>num;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
   int menge , numm , nummer , erg = 0;;
   cin >> menge;
   for(int i = 0 ; i < menge; i++){
      cin >> numm >> nummer;
      if(numm > 0){
         cmp.push_back({numm , i});
      }
      num.push_back(nummer);
   }
   int pl = cmp.size() - 1;
   for(int i = menge - 1;  i >= 0 ; i--){
      while(num[i]){
         if(cmp[pl][0] == 0){
            pl--;
         }
         if(pl < 0){
            break;
         }
         nummer = min(num[i], cmp[pl][0]);
         num[i] -= nummer;
         cmp[pl][0] -= nummer;
         erg += nummer * abs(i - cmp[pl][1]);
      }
   }
   cout << erg << "\n";
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 468 KB Output is correct
4 Incorrect 10 ms 2188 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 468 KB Output is correct
4 Incorrect 10 ms 2188 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Incorrect 1 ms 212 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 468 KB Output is correct
4 Incorrect 1 ms 212 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 468 KB Output is correct
4 Incorrect 1 ms 212 KB Output isn't correct
5 Halted 0 ms 0 KB -