답안 #371188

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
371188 2021-02-26T04:19:58 Z ja_kingy Circus (Balkan15_CIRCUS) C++14
0 / 100
24 ms 1892 KB
#include "circus.h"
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> pii;
vector<pii> can_slv;

void init(int N, int M, int P[]){
    int it = 0;
    sort(P, P+N);
    can_slv.push_back({M,M});
    for (int i = N; i-->0;) {
        while (it < can_slv.size() && can_slv[it].first >= P[i]) it++;
        int S = can_slv[it-1].second - P[i];
        can_slv.push_back({P[i] - S, P[i]});
    }
}

int minLength(int D) {
    auto p = lower_bound(can_slv.rbegin(), can_slv.rend(), make_pair(D,0));
    return p->second - D;
}

Compilation message

circus.cpp: In function 'void init(int, int, int*)':
circus.cpp:12:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   12 |         while (it < can_slv.size() && can_slv[it].first >= P[i]) it++;
      |                ~~~^~~~~~~~~~~~~~~~
grader.cpp: In function 'int main()':
grader.cpp:14:12: warning: unused variable 'max_code' [-Wunused-variable]
   14 |  long long max_code;
      |            ^~~~~~~~
grader.cpp:16:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   16 |  scanf("%d%d", &N, &M);
      |  ~~~~~^~~~~~~~~~~~~~~~
grader.cpp:18:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   18 |   scanf("%d", &P[i]);
      |   ~~~~~^~~~~~~~~~~~~
grader.cpp:21:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   21 |  scanf("%d", &Q);
      |  ~~~~~^~~~~~~~~~
grader.cpp:23:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   23 |   scanf("%d", &d);
      |   ~~~~~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 24 ms 1892 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 24 ms 1892 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 24 ms 1892 KB Output isn't correct
2 Halted 0 ms 0 KB -