Submission #659147

# Submission time Handle Problem Language Result Execution time Memory
659147 2022-11-16T19:14:02 Z zhing_zhou Timovi (COCI18_timovi) Java 11
20 / 80
976 ms 21156 KB
import java.util.*;
public class timovi
{
    public static void main(String args[])
    {
        Scanner sc = new Scanner(System.in);
        long n = sc.nextInt(), k = sc.nextInt(), m = sc.nextInt();
        long var1 = m / (2 * n * k);
        long a[] = new long[(int)(n)];
        for(long i = 0; i < n; i++)
        {
            a[(int)(i)] = (2 * k) * var1;
        }
        m -= (2 * n * k) * var1;
        long dir = 1, pos = 0;
        while(m != 0)
        {
             a[(int)(pos)] += Math.min(k, m);
             m -= Math.min(m, k);
             pos += dir;
             if(pos == n)
             {
                 dir = -1;
                 pos += dir;
                 pos += dir;
             }
        }
        for(long i = 0; i < n; i++)
        {
             System.out.print(a[(int)(i)] + " ");   
        }
        System.out.println();
        return;
    }
}
# Verdict Execution time Memory Grader output
1 Incorrect 133 ms 10984 KB Output isn't correct
2 Incorrect 122 ms 11004 KB Output isn't correct
3 Correct 879 ms 20380 KB Output is correct
4 Correct 871 ms 20076 KB Output is correct
5 Incorrect 121 ms 11156 KB Output isn't correct
6 Runtime error 96 ms 10220 KB Execution failed because the return code was nonzero
7 Incorrect 937 ms 20980 KB Output isn't correct
8 Incorrect 976 ms 21156 KB Output isn't correct