結果
| 問題 |
No.270 next_permutation (1)
|
| コンテスト | |
| ユーザー |
y_mazun
|
| 提出日時 | 2015-08-21 23:10:12 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 554 bytes |
| コンパイル時間 | 352 ms |
| コンパイル使用メモリ | 47,040 KB |
| 実行使用メモリ | 10,752 KB |
| 最終ジャッジ日時 | 2024-07-18 12:08:28 |
| 合計ジャッジ時間 | 5,074 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 10 TLE * 1 -- * 4 |
コンパイルメッセージ
main.cpp: In function ‘int getInt()’:
main.cpp:9:34: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
9 | inline int getInt(){ int s; scanf("%d", &s); return s; }
| ~~~~~^~~~~~~~~~
ソースコード
#include <algorithm>
#include <cstdlib>
#define REP(i,n) for(int i=0; i<(int)(n); i++)
typedef long long ll;
#include <queue>
#include <cstdio>
inline int getInt(){ int s; scanf("%d", &s); return s; }
#include <set>
using namespace std;
int main(){
const int n = getInt();
const int k = getInt();
vector<int> p(n);
vector<int> b(n);
ll a = 0;
REP(i,n) p[i] = getInt();
REP(i,n) b[i] = getInt();
REP(i,k){
REP(j,n) a += std::abs(p[j] - b[j]);
next_permutation(p.begin(), p.end());
}
printf("%lld\n", a);
return 0;
}
y_mazun