Submission #225666

# Submission time Handle Problem Language Result Execution time Memory
225666 2020-04-21T07:59:46 Z Ruxandra985 Rope (JOI17_rope) C++14
0 / 100
5 ms 384 KB
#include <bits/stdc++.h>

using namespace std;
int f[1000010] , v[1000010];
int main()
{
    FILE *fin = stdin;
    FILE *fout = stdout;
    int n , m , i , sol , j;
    fscanf (fin,"%d%d",&n,&m);
    for (i = 1 ; i <= n ; i++){
        fscanf (fin,"%d",&v[i]);
        f[v[i]]++;
    }

    for (i = 1 ; i <= m ; i++){

        sol = n - f[i];
        /// iti alegi o culoare auxiliara

        for (j = 1 ; j <= m ; j++){
            if (j != i)
                sol = min(sol , n - f[i] - f[j]);
        }

        fprintf (fout,"%d\n",sol);

    }

    return 0;
}

Compilation message

rope.cpp: In function 'int main()':
rope.cpp:10:12: warning: ignoring return value of 'int fscanf(FILE*, const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     fscanf (fin,"%d%d",&n,&m);
     ~~~~~~~^~~~~~~~~~~~~~~~~~
rope.cpp:12:16: warning: ignoring return value of 'int fscanf(FILE*, const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         fscanf (fin,"%d",&v[i]);
         ~~~~~~~^~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 4 ms 384 KB Output is correct
3 Incorrect 5 ms 384 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 4 ms 384 KB Output is correct
3 Incorrect 5 ms 384 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 4 ms 384 KB Output is correct
3 Incorrect 5 ms 384 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 4 ms 384 KB Output is correct
3 Incorrect 5 ms 384 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 4 ms 384 KB Output is correct
3 Incorrect 5 ms 384 KB Output isn't correct
4 Halted 0 ms 0 KB -