답안 #244231

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
244231 2020-07-03T07:53:50 Z WhipppedCream Just Long Neckties (JOI20_ho_t1) C++17
컴파일 오류
0 ms 0 KB
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>

using namespace std;

typedef pair<int, int> ii;
typedef vector<int> vi;
typedef long long ll;

#define f first
#define s second
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define rsz resize

const int md = 1e9+7;
const ll inf = 1e18;
const int maxn = 1e5+5;

template<class T> void ckmin(T &a, T b) { a = min(a, b); }
template<class T> void ckmax(T &a, T b) { a = max(a, b); }

ii arr[maxn];

int b[maxn];

int cur[maxn];

multiset<int> bst;

int main()
{
	int n; scanf("%d", &n);
	for(int i = 1; i<= n+1; i++)
	{
		scanf("%d", &arr[i].X);
		arr[i].Y = i;
	}
	sort(arr+1, arr+n+1);
	for(int i = 1; i<= n; i++)
	{
		scanf("%d", &b[i]);
	}
	sort(b+1, b+n+1);

	for(int i = 2; i<= n+1; i++)
	{
		cur[i-1] = arr[i].X;
		bst.insert(cur[i-1]-b[i-1]);
	}

	printf("%d ", *(--bst.end()));
	for(int i = 1; i<= n; i++)
	{
		bst.erase(bst.find(cur[i]-b[i]]));
		cur[i] = arr[i].X;
		bst.insert(cur[i]-b[i]);
		printf("%d ", *(--bst.end()));
	}
	printf("\n");
}

Compilation message

ho_t1.cpp: In function 'int main()':
ho_t1.cpp:41:23: error: 'ii {aka struct std::pair<int, int>}' has no member named 'X'
   scanf("%d", &arr[i].X);
                       ^
ho_t1.cpp:42:10: error: 'ii {aka struct std::pair<int, int>}' has no member named 'Y'
   arr[i].Y = i;
          ^
ho_t1.cpp:53:21: error: 'ii {aka struct std::pair<int, int>}' has no member named 'X'
   cur[i-1] = arr[i].X;
                     ^
ho_t1.cpp:60:33: error: expected ')' before ']' token
   bst.erase(bst.find(cur[i]-b[i]]));
                                 ^
ho_t1.cpp:61:19: error: 'ii {aka struct std::pair<int, int>}' has no member named 'X'
   cur[i] = arr[i].X;
                   ^
ho_t1.cpp:38:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  int n; scanf("%d", &n);
         ~~~~~^~~~~~~~~~
ho_t1.cpp:47:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d", &b[i]);
   ~~~~~^~~~~~~~~~~~~