Submission #6930836


Source Code Expand

Copy
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
            ∧_∧
      ∧_∧  (´<_` )  Welcome to My Coding Space!
     ( ´_ゝ`) /  ⌒i     @hamayanhamayan
    /   \     | |
    /   / ̄ ̄ ̄ ̄/  |
  __(__ニつ/     _/ .| .|____
     \/____/ (u ⊃
---------------------------------------------------------------------------------------------------*/













int M, N, K, X[2010];
//---------------------------------------------------------------------------------------------------
void _main() {
	cin >> M >> N >> K;
	rep(i, 0, N) cin >> X[i];

	int ans = 0;
	rep(m, 1, M + 1) {
		vector<int> cnt(M + 1);
		rep(i, 0, N) cnt[abs(m - X[i])]++;
		int tot = cnt[0];
		rep(k, 1, K + 1) if (cnt[k]) tot++;
		chmax(ans, tot);
	}
	cout << ans << endl;
}






Submission Info

Submission Time
Task B - 駒 (Pieces)
User hamayanhamayan
Language C++14 (GCC 5.4.1)
Score 100
Code Size 1691 Byte
Status AC
Exec Time 11 ms
Memory 256 KB

Judge Result

Set Name Sample 1 Sample 2 Sample 3 Sample 4 Sample 5 Sample 6 Subtask 1 Subtask 2 Subtask 3 Subtask 4
Score / Max Score 0 / 0 0 / 0 0 / 0 0 / 0 0 / 0 0 / 0 12 / 12 13 / 13 20 / 20 55 / 55
Status
AC × 1
AC × 1
AC × 1
AC × 1
AC × 1
AC × 1
AC × 7
AC × 10
AC × 12
AC × 36
Set Name Test Cases
Sample 1 sample-01.txt
Sample 2 sample-02.txt
Sample 3 sample-03.txt
Sample 4 sample-04.txt
Sample 5 sample-05.txt
Sample 6 sample-06.txt
Subtask 1 sample-01.txt, 01-01.txt, 01-02.txt, 01-03.txt, 01-04.txt, 01-05.txt, 01-06.txt
Subtask 2 sample-02.txt, sample-03.txt, sample-04.txt, 02-01.txt, 02-02.txt, 02-03.txt, 02-04.txt, 02-05.txt, 02-06.txt, 02-07.txt
Subtask 3 sample-01.txt, sample-03.txt, sample-04.txt, sample-05.txt, 03-01.txt, 03-02.txt, 03-03.txt, 03-04.txt, 03-05.txt, 03-06.txt, 03-07.txt, 03-08.txt
Subtask 4 sample-01.txt, sample-02.txt, sample-03.txt, sample-04.txt, sample-05.txt, sample-06.txt, 01-01.txt, 01-02.txt, 01-03.txt, 01-04.txt, 01-05.txt, 01-06.txt, 02-01.txt, 02-02.txt, 02-03.txt, 02-04.txt, 02-05.txt, 02-06.txt, 02-07.txt, 03-01.txt, 03-02.txt, 03-03.txt, 03-04.txt, 03-05.txt, 03-06.txt, 03-07.txt, 03-08.txt, 04-01.txt, 04-02.txt, 04-03.txt, 04-04.txt, 04-05.txt, 04-06.txt, 04-07.txt, 04-08.txt, 04-09.txt
Case Name Status Exec Time Memory
01-01.txt AC 1 ms 256 KB
01-02.txt AC 1 ms 256 KB
01-03.txt AC 1 ms 256 KB
01-04.txt AC 3 ms 256 KB
01-05.txt AC 8 ms 256 KB
01-06.txt AC 11 ms 256 KB
02-01.txt AC 1 ms 256 KB
02-02.txt AC 1 ms 256 KB
02-03.txt AC 4 ms 256 KB
02-04.txt AC 11 ms 256 KB
02-05.txt AC 3 ms 256 KB
02-06.txt AC 3 ms 256 KB
02-07.txt AC 3 ms 256 KB
03-01.txt AC 8 ms 256 KB
03-02.txt AC 8 ms 256 KB
03-03.txt AC 8 ms 256 KB
03-04.txt AC 8 ms 256 KB
03-05.txt AC 8 ms 256 KB
03-06.txt AC 8 ms 256 KB
03-07.txt AC 8 ms 256 KB
03-08.txt AC 8 ms 256 KB
04-01.txt AC 3 ms 256 KB
04-02.txt AC 9 ms 256 KB
04-03.txt AC 9 ms 256 KB
04-04.txt AC 9 ms 256 KB
04-05.txt AC 9 ms 256 KB
04-06.txt AC 8 ms 256 KB
04-07.txt AC 9 ms 256 KB
04-08.txt AC 9 ms 256 KB
04-09.txt AC 9 ms 256 KB
sample-01.txt AC 1 ms 256 KB
sample-02.txt AC 1 ms 256 KB
sample-03.txt AC 1 ms 256 KB
sample-04.txt AC 1 ms 256 KB
sample-05.txt AC 1 ms 256 KB
sample-06.txt AC 1 ms 256 KB