君はまるで砂漠に咲く、一輪の花。

僕はその花に引き寄せられる蝶。

Codeforces Beta Round #63 (Div. 2)

はい。 最終更新;2015/01/15
http://codeforces.com/contest/69

A. Young Physicist

ざっくりと大意

・高校生のVasyaは物理の勉強よりホッケーを見るのが好きで宿題を忘れて特別課題を出された。
・n個の数列のx,y,zのそれぞれの合計のベクトルが0と等しいか??

方針のようなもの

・それぞれの和を見る。

n=int(raw_input())
x=y=z=0
for i in range(n):
    dx,dy,dz=map(int, raw_input().split())
    x,y,z=x+dx,y+dy,z+dz
print 'YES' if x==0 and y==0 and z==0 else 'NO'
#include<iostream>
#include<cmath>
#include<string>
#include<cctype>
#include<vector>
#include<numeric>
#include<algorithm>
using namespace std;


int main(){
    double pai=3.141592653589;
    int n,tx=0,ty=0,tz=0;
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        int x,y,z;
        scanf("%d %d %d",&x,&y,&z);
        tx+=x;
        ty+=y;
        tz+=z;
    }
    if(tx==ty && ty==tz && tz==0){
        printf("YES\n");
    }else{
        printf("NO\n");
    }
    return 0;
}

問題文が読みにくいのとかはサンプルからエスパーする能力も結構必要かなーと思う。

B. Bets

ざっくりと大意

・m個の数列のl,r,t,cを条件通りに処理して合計で幾つになるか??

方針のようなもの

http://codeforces.com/contest/69/submission/394909 をパクった。後で

n,m=map(int,raw_input().split())
ans=0
tm=[5000]*n
win=[-1]*n
p=[0]*m
for i in xrange(m):
    m-=1
    l,r,t,c=map(int,raw_input().split())
    p[i]=c
    for j in xrange(l-1,r):
        if tm[j]>t:
            tm[j]=t
            win[j]=i
for i in xrange(n):
    if win[i]!=-1:
        ans+=p[win[i]]
print ans