| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1224357 | vipul | Group Photo (JOI21_ho_t3) | C++17 | 0 ms | 320 KiB |
#include <iostream>
#include <vector>
using namespace std;
int main() {
int N;
cin >> N;
vector<int> A(N);
for (int i = 0; i < N; ++i) {
cin >> A[i];
A[i]+=(2*i);
}
int ans = 0;
for (int i = 1; i < N; ++i) {
int j = i;
while (j > 0) {
int left = A[j - 1] ;
int right = A[j] ;
if (left < right) break;
// Swap values
swap(A[j], A[j - 1]);
// Update their values according to their new position
A[j - 1] -= 2;
A[j] += 2;
ans++;
j--;
}
}
cout <<"Ans is "<<endl<< ans << endl;
return 0;
}| # | 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... | ||||
