| # | Time | Username | Problem | Language | Result | Execution time | Memory | 
|---|---|---|---|---|---|---|---|
| 211711 | goodboy | Potatoes and fertilizers (LMIO19_bulves) | C++14 | 19 ms | 18048 KiB | 
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <stdio.h> 
#include <math.h>
using namespace std;
int fertiliser[1111111],potatoes[1111111];
int main() {
    int n , a , b;
    scanf("%d",&n);
	int pot = 0, fert = 0;
    for (int i = 1; i <= n; i++){
    	scanf("%d%d",&a,&b);
      	for (int j = 1; j <= a; j++){
          	fert++;
          	fertiliser[fert] = i;
		}
      	for (int j = 1; j <= b; j++){
          	pot++;
          	potatoes[pot] = i;
        }
  	}
  	long long ans = 0;
  	for(int i = 1; i <= pot; i++)ans += abs(fertiliser[i] - potatoes[i]);
  	printf("%lld\n",ans);
}
Compilation message (stderr)
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
