評分結果(參考) : AC (2ms, 340KB)
#include <bits/stdc++.h>
#define int long long
using namespace std;
signed main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n, a, b;
cin >> n;
int x=0, y=0;
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};
for(int i=0; i<n; i++){
cin >> a >> b;
x += dx[a]*b;
y += dy[a]*b;
}
cout << x << " " << y;
return 0;
}