結果

問題 No.335 門松宝くじ
ユーザー h_nosonh_noson
提出日時 2016-05-03 23:20:37
言語 C++11
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 1,188 bytes
コンパイル時間 607 ms
コンパイル使用メモリ 60,768 KB
実行使用メモリ 14,008 KB
最終ジャッジ日時 2024-04-15 11:07:41
合計ジャッジ時間 6,036 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
10,012 KB
testcase_01 AC 1 ms
6,944 KB
testcase_02 AC 2 ms
6,940 KB
testcase_03 AC 1 ms
6,944 KB
testcase_04 AC 2 ms
6,944 KB
testcase_05 AC 709 ms
6,944 KB
testcase_06 AC 1,068 ms
6,944 KB
testcase_07 TLE -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

#define RREP(i,s,e) for (i = s; i >= e; i--)
#define rrep(i,n) RREP(i,(int)(n)-1,0)
#define REP(i,s,e) for (i = s; i <= e; i++)
#define rep(i,n) REP(i,0,(int)(n)-1)
#define INF 100000000

typedef long long ll;

int prize(int a, int b, int c) {
    if (a != c && (b < min(a,c) || b > max(a,c)))
        return max({a,b,c});
    else
        return 0;
}

int main() {
    int i, j, k, l, n, m, ans, mx;
    int e[3][800];
    cin >> n >> m;
    rep (i,m) rep (j,n) cin >> e[i][j];
    mx = ans = 0;
    rep (i,m) {
        double sum = 0, cnt = 0;
        rep (j,n) REP (k,j+1,n-1) {
            int p = 0;
            rep (l,n) {
                if (l < j)
                    p = max(p,prize(e[i][l],e[i][j],e[i][k]));
                else if (l < k)
                    p = max(p,prize(e[i][j],e[i][l],e[i][k]));
                else 
                    p = max(p,prize(e[i][j],e[i][k],e[i][l]));
            }
            sum += p;
            cnt++;
        }
        sum /= cnt;
        if (mx < sum) {
            mx = sum;
            ans = i;
        }
    }
    cout << ans << endl;
    return 0;
}
0