답안 #723376

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
723376 2023-04-13T16:23:13 Z abouton Measures (CEOI22_measures) C++17
0 / 100
1500 ms 316 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long

int N, M, D;
vector<int> pos;

signed main()
{
    scanf("%lld%lld%lld", &N, &M, &D);
    for (int i = 0; i < N; i ++) 
    {
        int a;
        scanf("%lld", &a);
        pos.push_back(a);
    }

    for (int x = 0; x < M; x ++)
    {
        int a; scanf("%lld", &a);
        int cur = pos.size()-1;
        pos.push_back(0);
        while (cur >= 0 && pos[cur] > a)
        {
            pos[cur+1] = pos[cur];
            cur --;
        }
        cur++;
        pos[cur]=a;
        
        int maxi = 0;
        for (int i = 0; i < (int)pos.size(); i ++)
        {
            for (int j = i+1; j < (int)pos.size(); j ++)
            {
                maxi = max(maxi, (j-i)*D - (pos[j]-pos[i]));
            }
        }
        if (maxi%2==1) cout << (maxi-1)/2 << ".5 ";
        else cout << maxi/2 << ' ';
        //for( int i = 0; i < pos.size(); i ++) printf("%d ", pos[i]);
        //printf("\n");
    }
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:10:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   10 |     scanf("%lld%lld%lld", &N, &M, &D);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
Main.cpp:14:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   14 |         scanf("%lld", &a);
      |         ~~~~~^~~~~~~~~~~~
Main.cpp:20:21: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   20 |         int a; scanf("%lld", &a);
      |                ~~~~~^~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 26 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 26 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1533 ms 316 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1533 ms 316 KB Time limit exceeded
2 Halted 0 ms 0 KB -