답안 #228498

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
228498 2020-05-01T09:08:09 Z Ruxandra985 Collecting Stamps 3 (JOI20_ho_t3) C++14
0 / 100
5 ms 256 KB
#include <bits/stdc++.h>
#define DIMN 210
using namespace std;
long long v[DIMN] , t[DIMN];
int main()
{
    FILE *fin = stdin;
    FILE *fout = stdout;
    long long n , l , i , j , curr , poz , timp , urm , sol = 0;
    fscanf (fin,"%lld%lld",&n,&l);

    for (i = 1 ; i <= n ; i++)
        fscanf (fin,"%lld",&v[i]);

    for (i = 1 ; i <= n ; i++)
        fscanf (fin,"%lld",&t[i]);

    for (i = 1 ; i < n ; i++){
        for (j = i + 1 ; j <= n ; j++){

            /// merge clockwise pana la i, apoi se intoarce si merge counter pana la j

            poz = 0;
            timp = 0;
            curr = 0;
            urm = 0;

            while (poz != v[i]){
                timp += v[urm + 1] - poz;

                if (t[urm + 1] >= timp)
                    curr++;

                poz = v[urm + 1];
                urm++;
            }

            /// ai ajuns in i, acum te intorci
            poz = l;
            timp *= 2;
            urm = n + 1;

            while (poz != v[j]){
                timp += poz - v[urm - 1];

                if (t[urm - 1] >= timp)
                    curr++;

                poz = v[urm - 1];
                urm--;
            }

            sol = max(sol , curr);

            /// -----------------------------------------------------------------

            /// merge mai intai counter pana la j, apoi clockwise pana la i

            //if (i == 5 && j == 6)
              //  printf ("a");

            poz = l;
            timp = 0;
            urm = n + 1;
            curr = 0;

            while (poz != v[j]){
                timp += poz - v[urm - 1];

                if (t[urm - 1] >= timp)
                    curr++;

                poz = v[urm - 1];
                urm--;
            }
            /// ai ajuns in j , acum te intorci catre i


            poz = 0;
            timp *= 2;
            urm = 0;

            while (poz != v[i]){
                timp += v[urm + 1] - poz;

                if (t[urm + 1] >= timp)
                    curr++;

                poz = v[urm + 1];
                urm++;
            }

            sol = max(sol , curr);

            //if (curr == 8)
              //  printf ("%lld %lld\n" , i , j);

        }
    }


    poz = 0;
    timp = 0;
    curr = 0;
    urm = 0;

    while (poz != v[n]){
        timp += v[urm + 1] - poz;

        if (t[urm + 1] >= timp)
            curr++;

        poz = v[urm + 1];
        urm++;
    }

    sol = max(sol , curr);

    /// ---------------------------------------------------------------

    poz = l;
    timp = 0;
    urm = n + 1;
    curr = 0;

    while (poz != v[1]){
        timp += poz - v[urm - 1];

        if (t[urm - 1] >= timp)
            curr++;

        poz = v[urm - 1];
        urm--;
    }

    sol = max(sol , curr);


    fprintf (fout,"%lld",sol);

    return 0;
}

Compilation message

ho_t3.cpp: In function 'int main()':
ho_t3.cpp:10:12: warning: ignoring return value of 'int fscanf(FILE*, const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     fscanf (fin,"%lld%lld",&n,&l);
     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
ho_t3.cpp:13:16: warning: ignoring return value of 'int fscanf(FILE*, const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         fscanf (fin,"%lld",&v[i]);
         ~~~~~~~^~~~~~~~~~~~~~~~~~
ho_t3.cpp:16:16: warning: ignoring return value of 'int fscanf(FILE*, const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         fscanf (fin,"%lld",&t[i]);
         ~~~~~~~^~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 256 KB Output is correct
2 Incorrect 4 ms 256 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 256 KB Output is correct
2 Incorrect 4 ms 256 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 256 KB Output is correct
2 Incorrect 4 ms 256 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 256 KB Output is correct
2 Incorrect 4 ms 256 KB Output isn't correct
3 Halted 0 ms 0 KB -