結果
| 問題 |
No.2648 [Cherry 6th Tune D] 一次元の馬
|
| コンテスト | |
| ユーザー |
vjudge1
|
| 提出日時 | 2025-11-20 16:17:02 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 1,128 bytes |
| コンパイル時間 | 765 ms |
| コンパイル使用メモリ | 80,872 KB |
| 実行使用メモリ | 19,400 KB |
| 最終ジャッジ日時 | 2025-11-20 16:17:10 |
| 合計ジャッジ時間 | 8,012 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | TLE * 1 -- * 37 |
ソースコード
#include<iostream>
#include<vector>
#include<utility>
#include<unistd.h>
#include<cstdlib>
#include <algorithm>
using namespace std;
bool is_sorted(vector<int> a){
for(int i = 0 ; i < a.size() - 1;i++){
if(a[i]< a[i+1]){
continue;
}else return false;
}
return true;
}
bool All_same(vector<int> a){
for(int i = 1 ; i < a.size();i++){
if(a[0]==a[i]){
continue;
}else
{
return false;
}
}
return true;
}
int main(){
int n;
cin>>n;
vector<int> A(n);
for(int i = 0; i < n; i++){
cin>>A[i];
}
vector<int> A2(n);
A2 = A;
if(is_sorted(A)) {
cout << 0;
return 0;
}
if(All_same(A)){
int a = 1;
cout<<a;
return 0;
}
int count = 0;
do
{
for (int i = 0; i < n; i++)
{
if(i == n-1){
A2[i]= A[0]+A2[i];
}else{
A2[i] += A[i+1];
}
}
count++;
} while (!is_sorted(A2));
cout<<count;
return 0;
}
vjudge1