Submission #205652

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
2056522020-02-29 11:27:52KastandaRope (JOI17_rope)C++11
45 / 100
2571 ms16504 KiB
// In The Name Of The Queen
#include<bits/stdc++.h>
using namespace std;
const int N = 1000006;
int n, m, Mxc, A[N], C[N], dp[N][2][2];
inline void smin(int &a, int b) {a = min(a, b);}
int main()
{
scanf("%d%d", &n, &m);
for (int i = 1; i <= n; i ++)
scanf("%d", &A[i]), C[A[i]] ++;
for (int i = 1; i <= m; i ++)
if (C[i] > C[Mxc])
Mxc = i;
for (int c = 1; c <= m; c ++)
{
int Mn = n - C[c];
for (int d = 1; d <= m; d ++)
if (d != c)
{
int cls[2] = {c, d}, cnt[2] = {0, 0};
memset(dp, 63, sizeof(dp));
for (int i = 1; i <= n; i ++)
{
cnt[0] += (A[i] != cls[0]);
cnt[1] += (A[i] != cls[1]);
dp[i][0][0] = dp[i][0][1] = cnt[0];
dp[i][1][0] = dp[i][1][1] = cnt[1];
}
for (int i = 1; i < n; i ++)
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

rope.cpp: In function 'int main()':
rope.cpp:9:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d%d", &n, &m);
     ~~~~~^~~~~~~~~~~~~~~~
rope.cpp:11:27: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d", &A[i]), C[A[i]] ++;
         ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...