这题 SPJ
查看原帖
这题 SPJ
28313
皎月半洒花小花楼主2020/5/28 17:01

由于担心自己可能写挂所以摆出来让大家 hack。

emmm 放心,如果锅很大我会删帖的(

#include "testlib.h"

using namespace std ;

const int MAXN = 1005 + 10 ;

void YES() {
    quitf(_ok, "Yang Chaoyue is the best! *v*");
}
void NO1() {
    quitf(_wa, "Hmm, there is something wrong, your sum is smaller than Yang Chaoyue got. >_<");
    exit(0);
}
void NO2() {
    quitf(_wa, "Hmm, there is something wrong, Yang Chaoyue doesn't think it's a correct Solution. >_<");
    exit(0);
}
void NO3() {
    quitf(_wa, "Hey! Don't you try to fool me ? Your sum can't match your solution ! >_<");
    exit(0);
}
int n, m ;
long long val[MAXN][MAXN] ;
bool A[MAXN][MAXN] ;
bool match[MAXN] ;
void readInf() {
    int x, y, z ;
    n = inf.readInt(), m = inf.readInt() ;
    for (int i = 1 ; i <= m ; ++ i){
        x = inf.readInt() ;
        y = inf.readInt() ;
        z = inf.readInt() ;
        val[x][y] = z ;
        A[x][y] = 1 ;
    }
}
int main(int argc, char *argv[]) {
    registerTestlibCmd(argc, argv);
    
    readInf() ; match[0] = 1 ;
    long long don_t_lie_to_me = 0 ;
    long long myans = ans.readLong() ;
    long long yourans = ouf.readLong() ;
    if (myans != yourans) return NO1(), 0 ;
    for (int y = 1 ; y <= n ; ++ y){
        int x = ouf.readInt() ;
        if (x > n || x < 1) return NO2(), 0 ;
        if (!A[x][y]) return NO2(), 0 ;
        if (match[x]) return NO2(), 0 ;
        don_t_lie_to_me += val[x][y] ;
        match[x] = 1 ;
    }
    if (don_t_lie_to_me != yourans) return NO3(), 0 ;
    YES() ;
    return 0;
}


2020/5/28 17:01
加载中...