AtCoder Grand Contest 018

Submission #5893890

Source codeソースコード

#include <bits/stdc++.h>

using namespace std;

#define _for(i,j,N) for(int i = (j);i < (N);i++)
#define _rep(i,j,N) for(int i = (j);i <= (N);i++)
#define ALL(x) x.begin(),x.end()
#define pb push_back
#define mk make_pair

typedef long long LL;
typedef pair<int,int> Interval;

template<typename T>
ostream& operator<<(ostream& os,const vector<T>& v) {
    _for(i,0,v.size()) os << v[i] << " ";
    return os;
}

template<typename T>
ostream& operator<<(ostream& os,const set<T>& v){
    for(typename set<T>::iterator it = v.begin();it != v.end();it++)
    os << *it <<" ";
    return os;
}
const int maxn = 305;
int A[maxn][maxn];
int p[maxn];
int N,M;

int main()
{
    scanf("%d %d",&N,&M);
    _for(i,0,N){
        _for(j,0,M){
            scanf("%d",&A[i][j]);
        }
    }
    set<int> dele;
    int ans = N;

    _for(i,0,M-1){
        int maxc = 0;
        int maxm = -1;
        map<int,int> mp;

        _for(i,0,N){
            int &ind = p[i];
            while(dele.count(A[i][ind])){
                ind++;
            }
            if(++mp[A[i][ind]] > maxc){
                maxm = A[i][ind];
                maxc = mp[A[i][ind]];
            }
        }

        ans = min(ans,maxc);
        dele.insert(maxm);
    }

    cout << ans << endl;

    return 0;
}

Submission

Task問題 B - Sports Festival
User nameユーザ名 youenn98
Created time投稿日時
Language言語 C++14 (GCC 5.4.1)
Status状態 AC
Score得点 700
Source lengthソースコード長 1343 Byte
File nameファイル名
Exec time実行時間 18 ms
Memory usageメモリ使用量 640 KB

Compiler messageコンパイルメッセージ

./Main.cpp: In function ‘int main()’:
./Main.cpp:33:25: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d %d",&N,&M);
^
./Main.cpp:36:33: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d",&A[i][j]);
^

Test case

Set

Set name Score得点 / Max score Cases
Sample - sample_01.txt,sample_02.txt,sample_03.txt
All 700 / 700 sample_01.txt,sample_02.txt,sample_03.txt,sample_01.txt,sample_02.txt,sample_03.txt,subtask_1_01.txt,subtask_1_02.txt,subtask_1_03.txt,subtask_1_04.txt,subtask_1_05.txt,subtask_1_06.txt,subtask_1_07.txt,subtask_1_08.txt,subtask_1_09.txt,subtask_1_10.txt,subtask_1_11.txt,subtask_1_12.txt,subtask_1_13.txt,subtask_1_14.txt,subtask_1_15.txt,subtask_1_16.txt,subtask_1_17.txt,subtask_1_18.txt

Test case

Case name Status状態 Exec time実行時間 Memory usageメモリ使用量
sample_01.txt AC 1 ms 256 KB
sample_02.txt AC 1 ms 256 KB
sample_03.txt AC 1 ms 256 KB
subtask_1_01.txt AC 1 ms 256 KB
subtask_1_02.txt AC 1 ms 384 KB
subtask_1_03.txt AC 2 ms 256 KB
subtask_1_04.txt AC 3 ms 384 KB
subtask_1_05.txt AC 1 ms 384 KB
subtask_1_06.txt AC 5 ms 640 KB
subtask_1_07.txt AC 4 ms 640 KB
subtask_1_08.txt AC 3 ms 640 KB
subtask_1_09.txt AC 1 ms 640 KB
subtask_1_10.txt AC 3 ms 256 KB
subtask_1_11.txt AC 4 ms 384 KB
subtask_1_12.txt AC 2 ms 256 KB
subtask_1_13.txt AC 6 ms 384 KB
subtask_1_14.txt AC 17 ms 640 KB
subtask_1_15.txt AC 12 ms 640 KB
subtask_1_16.txt AC 18 ms 640 KB
subtask_1_17.txt AC 16 ms 640 KB
subtask_1_18.txt AC 11 ms 640 KB