Submission #1832514


Source Code Expand

#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <queue>
#include <utility>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;

#define For(i, a, b) for(int i = (a); i < (b); i++)
#define Rep(i, n) For(i, 0, (n))

const int inf = 999999999;
const int mod = 1000000007;
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};

int main(){
	ll n, k; cin >> n >> k;
	ll a[n]; ll ans = 0, now = 0;
	Rep(i, n){
		cin >> a[i];
		if(i > 0){
			if(now < a[i]){
				now = a[i];
			}else{
				ans += now - a[i] + 1;
				now += 1;
			}
		}else{
			now = a[i];
		}
	}
	cout << ans << endl;
	return 0;
}

Submission Info

Submission Time
Task B - Buildings are Colorful!
User takune
Language C++14 (GCC 5.4.1)
Score 120
Code Size 701 Byte
Status WA
Exec Time 1 ms
Memory 256 KB

Judge Result

Set Name Sample Subtask1 Subtask2 Subtask3
Score / Max Score 0 / 0 120 / 120 0 / 90 0 / 140
Status
AC × 1
WA × 1
AC × 2
WA × 3
AC × 3
WA × 6
Set Name Test Cases
Sample sub0_in1.txt, sub0_in2.txt
Subtask1 sub1_in1.txt, sub1_in2.txt
Subtask2 sub2_in1.txt, sub2_in2.txt, sub2_in3.txt
Subtask3 sub0_in1.txt, sub0_in2.txt, sub1_in1.txt, sub1_in2.txt, sub2_in1.txt, sub2_in2.txt, sub2_in3.txt, sub3_in1.txt, sub3_in2.txt
Case Name Status Exec Time Memory
sub0_in1.txt AC 1 ms 256 KB
sub0_in2.txt WA 1 ms 256 KB
sub1_in1.txt AC 1 ms 256 KB
sub1_in2.txt AC 1 ms 256 KB
sub2_in1.txt WA 1 ms 256 KB
sub2_in2.txt WA 1 ms 256 KB
sub2_in3.txt WA 1 ms 256 KB
sub3_in1.txt WA 1 ms 256 KB
sub3_in2.txt WA 1 ms 256 KB