Submission #282164

# Submission time Handle Problem Language Result Execution time Memory
282164 2020-08-24T05:22:48 Z 임성재(#5755) None (JOI15_walls) C++17
10 / 100
3000 ms 1144 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];
ll ans[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;

		for(int j=1; j<=n; j++) {
			if(p < a[j]) {
				ans[j] += a[j] - p;
				b[j] += p - a[j];
				a[j] = p;
			}
			else if(p > b[j]) {
				ans[j] += p - b[j];
				a[j] += p - b[j];
				b[j] = p;
			}
		}
	}

	for(int i=1; i<=n; i++) {
		cout << ans[i] << "\n";
	}
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 24 ms 892 KB Output is correct
3 Correct 24 ms 640 KB Output is correct
4 Correct 25 ms 672 KB Output is correct
5 Correct 25 ms 768 KB Output is correct
6 Correct 24 ms 768 KB Output is correct
7 Correct 22 ms 768 KB Output is correct
8 Correct 23 ms 768 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1619 ms 972 KB Output is correct
2 Execution timed out 3049 ms 1144 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 24 ms 892 KB Output is correct
3 Correct 24 ms 640 KB Output is correct
4 Correct 25 ms 672 KB Output is correct
5 Correct 25 ms 768 KB Output is correct
6 Correct 24 ms 768 KB Output is correct
7 Correct 22 ms 768 KB Output is correct
8 Correct 23 ms 768 KB Output is correct
9 Correct 1619 ms 972 KB Output is correct
10 Execution timed out 3049 ms 1144 KB Time limit exceeded
11 Halted 0 ms 0 KB -