제출 #825141

#제출 시각아이디문제언어결과실행 시간메모리
825141tpd2kArranging Shoes (IOI19_shoes)C++14
컴파일 에러
0 ms0 KiB
// teddybear's code
// the one who loves NBP
// noe the second
// goal: 0 / 8
// get medal in APIO (like TKN)
//#pragma GCC optimize("O3,unroll-loops")
//#pragma GCC target("avx2,bmi,bmi2,popcnt,lzcnt")

// prob: 
#include <bits/stdc++.h>
using namespace std;

#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")

#define FOR(i,n) for (int i = 0; i<n; i++)
using ll = long long;
using ull = unsigned long long;
ll n,m,t;
ll cnt = 0;
const int maxn = 1e5;
const ll mod = 1e9 + 7;
#define Y "YES"
#define N "NO"
ll a[2 * maxn + 5];
bool visited[1005][1005];
int dist[1005][1005];
int w,h;
int fx[4] = {-1, 1, 0, 0};
int fy[4] = {0, 0, -1, 1};
queue <pair<int,int>> q;
ll dis[2 * maxn + 5];
pair<ll,ll> p[2 * maxn + 5];

ll dp[2 * maxn + 5];

void solve()
{
	cin >> n;
	for (int i = 1; i<=n; i++)
	{
		cin >> p[i].first >> p[i].second;
	}
	sort(p+1,p+n+1);
	ll mx = 0;
	/*for (int i = 1; i<=n; i++)
	{
		ll up = -1, down = 1e16;
		ll tmp = 0, sum = 0;
		for (int j = i; j<=n; j++)
		{
			sum += p[j].second;
			up = max(up, p[j].first);
			down = min(down, p[j].first);
			tmp = max(tmp, sum + down - up);
		}
		mx = max(mx, tmp);
	}*/
	ll tmp = 0;
	for (int i = 1; i<=n; i++)
	{
		dp[i] = max(dp[i-1] + p[i].second - (p[i].first - p[i-1].first), p[i].second);
		tmp = max(tmp, dp[i]);
	}
	cout << tmp;
	
}

void init()
{
 	int te = 1; //cin >> te;
 	while (te--)
 	{
 	 	  solve();
 	}
}

void preprocess()
{

}


int main()
{
 	ios_base::sync_with_stdio(false);
 	cin.tie(NULL);
    //cin.tie(0); cout.tie(0);
    //freopen(".inp", "r", stdin);
    //freopen(".out", "w", stdout);
 	init();
 	preprocess();
 	//solve();
 	return 0;
}

컴파일 시 표준 에러 (stderr) 메시지

shoes.cpp: In function 'void solve()':
shoes.cpp:45:5: warning: unused variable 'mx' [-Wunused-variable]
   45 |  ll mx = 0;
      |     ^~
/usr/bin/ld: /tmp/ccvjFcf9.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccxqbKAa.o:shoes.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/ccvjFcf9.o: in function `main':
grader.cpp:(.text.startup+0x29d): undefined reference to `count_swaps(std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status