//Codeforces Round #178 (Div. 2) A Shaass and Oskols
import java.io.*;
import java.io.ObjectInputStream.GetField;
import java.math.*;
import java.text.*;
import java.util.*;
//Codeforces
public class MainCodeforces1 {
private static MyScanner in;
private static PrintStream out;
private static void solve() throws IOException
{
int n = in.nextInt();
int[] a = new int[n];
for (int i = 0; i < a.length; i++) {
a[i] = in.nextInt();
}
int m = in.nextInt();
int[] x = new int[m];
int[] y = new int[m];
for (int i = 0; i < y.length; i++) {
x[i] = in.nextInt();
y[i] = in.nextInt();
}
for (int i = 0; i < m; i++) {
int px = x[i] - 1;
int py = y[i] - 1;
if (px > 0) {
a[px - 1] += py;
}
if (px < n - 1) {
a[px + 1] += a[px] - (py + 1);
}
a[px] = 0;
}
for (int i = 0; i < a.length; i++) {
out.println(a[i]);
}
}
public static void main(String[] args) throws IOException {
// helpers for input/output
boolean LOCAL_TEST = false;// change to false before submitting
out = System.out;
if (LOCAL_TEST) {
in = new MyScanner("E:\\zin2.txt");
}
else {
boolean usingFileForIO = false;
if (usingFileForIO) {
// using input.txt and output.txt as I/O
in = new MyScanner("input.txt");
out = new PrintStream("output.txt");
}
else {
in = new MyScanner();
out = System.out;
}
}
solve();
}
// =====================================
static class MyScanner {
Scanner inp = null;
public MyScanner() throws IOException
{
inp = new Scanner(System.in);
}
public MyScanner(String inputFile) throws IOException {
inp = new Scanner(new FileInputStream(inputFile));
}
public int nextInt() throws IOException {
return inp.nextInt();
}
public long nextLong() throws IOException {
return inp.nextLong();
}
public double nextDouble() throws IOException {
return inp.nextDouble();
}
public String nextString() throws IOException {
return inp.next();
}
}
}
No comments:
Post a Comment