結果
| 問題 | No.929 よくあるボールを移動するやつ |
| コンテスト | |
| ユーザー |
mmn15277198
|
| 提出日時 | 2020-03-14 02:51:29 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 574 bytes |
| 記録 | |
| コンパイル時間 | 686 ms |
| コンパイル使用メモリ | 78,960 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-23 18:12:32 |
| 合計ジャッジ時間 | 4,224 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 9 WA * 3 |
ソースコード
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<string.h>
#include<math.h>
#include<iomanip>
using namespace std;
int syc(long i,long Min,long Max){
if(Min <= i && i <= Max){
return 1;
}else{
exit(1);
//return 0;
}
}
int main(){
int n,count=0;
cin >> n;
int a[n];
for(int i=0;i<n;i++){
cin >> a[i];
}
for(int i=0;i<n;i++){
if(a[i] >= 2){
for(int j=0;j<n;j++){
if(a[i]==1)break;
if(a[j]==0){
a[j]=1;
a[i]=a[i]-1;
count += abs(i-j);
}
}
}
}
cout << count << endl;
return 0;
}
mmn15277198