Submission #282163

# Submission time Handle Problem Language Result Execution time Memory
282163 2020-08-24T05:17:26 Z 임성재(#5755) None (JOI15_walls) C++17
0 / 100
8 ms 896 KB
#include<bits/stdc++.h>
using namespace std;

#define fast ios::sync_with_stdio(false); cin.tie(0);
#define fi first
#define se second
#define em emplace
#define eb emplace_back
#define mp make_pair
#define all(v) (v).begin(), (v).end()

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const int inf = 1e9 + 7;
const ll INF = 1e18;

int n, m;
int a[200010];
int b[200010];

int main() {
	fast;

	cin >> n >> m;

	for(int i=1; i<=n; i++) {
		cin >> a[i] >> b[i];
	}

	for(int i=1; i<=m; i++) {
		int p;
		cin >> p;

		if(a[1] <= p && p <= b[1]) cout << "0\n";
		else if(p < a[1]) {
			cout << a[1] - p << "\n";
			b[1] -= a[1] - p;
			a[1] = p;
		}
		else {
			cout << p - b[1] << "\n";
			a[1] += p - b[1];
			b[1] = p;
		}
	}
}
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 512 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 8 ms 896 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 512 KB Output isn't correct
2 Halted 0 ms 0 KB -