結果
| 問題 |
No.90 品物の並び替え
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-02-18 11:54:43 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,325 bytes |
| コンパイル時間 | 1,418 ms |
| コンパイル使用メモリ | 80,648 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-05 12:40:02 |
| 合計ジャッジ時間 | 1,091 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 1 |
| other | WA * 9 |
ソースコード
#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
#include <set>
#include <vector>
#include <map>
#include <list>
#include <stack>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <queue>
#define mkp(a, b) make_pair(a, b)
#define pb(t) push_back(t)
#define ft first
#define sc second
#define pt(num) cout << num << "\n"
#define moC(a, s, b) (a)=((a)s(b)+MOD)%MOD
#define max(a, b) ((a)>(b) ? (a):(b))
#define min(a, b) ((a)<(b) ? (a):(b))
#define chmax(a, b) (a<b ? a=b : 0)
#define chmin(a, b) (a>b ? a=b : 0)
#define INF 1000000000000000000
#define MOD 1000000007LL
#define MAX 101010
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef map<ll, ll> Map;
int main(void) {
ll N, M;
cin >> N >> M;
ll i, j, k;
ll g[11][11]={};
vector<ll> v;
ll fa[11]={};
fa[0]=1;
for(i=1; i<=N; i++) fa[i]=fa[i-1]*i;
for(i=0; i<N; i++) v.pb(i);
for(i=0; i<M; i++) {
ll a, b, c;
cin >> a >> b >> c;
g[a][b]=c;
}
ll ans=0;
for(k=0; k<fa[N]; k++) {
ll t=0;
for(i=0; i<v.size(); i++) {
for(j=i+1; j<v.size(); j++) {
t+=g[v[i]][v[j]];
}
}
chmax(ans, t);
next_permutation(v.begin(), v.end());
}
}