結果
問題 | No.742 にゃんにゃんにゃん 猫の挨拶 |
ユーザー |
|
提出日時 | 2019-12-12 14:24:00 |
言語 | C++11 (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2,302 ms / 2,500 ms |
コード長 | 561 bytes |
コンパイル時間 | 1,697 ms |
コンパイル使用メモリ | 161,200 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-25 00:36:58 |
合計ジャッジ時間 | 5,979 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 16 |
ソースコード
#include "bits/stdc++.h"using namespace std;typedef long long int ll;typedef pair<ll, ll > pi;typedef pair<pair<ll, ll >, ll > pii;vector<ll > vec;vector<vector<ll > > vec2;ll MOD = 1000000007;int main(){ll N;cin >> N;vector<ll > M(N, 0);for(ll i = 0; i < N; i++){cin >> M[i];}ll ans = 0;for(ll i = 0; i < N; i++){for(ll j = 1; j < N; j++){if(M[j-1] > M[j]){swap(M[j-1], M[j]);ans++;}}}cout << ans << endl;}