/**************************************************************
Problem: 1202
User: Leefir
Language: C++
Result: Accepted
Time:120 ms
Memory:1292 kb
****************************************************************/
```cpp
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <ctime>
#include <cmath>
#include <cassert>
#include <climits>
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
#define rep(i, a, b) for(int i = a, i##_END_ = b; i < i##_END_; ++i)
#define per(i, a, b) for(int i = (b)-1, i##_BEGIN_ = a; i >= i##_BEGIN_; --i)
#define foreach(it, x) for(__typeof((x).begin()) it = (x).begin(); it != (x).end(); ++it)
#ifdef Leefir
#define ast(x) assert(x)
#define dig(...) fprintf(stderr, __VA_ARGS__)
#else
#define ast(x) ;
#define dig(...) ;
#endif
#define showtime dig("%.6lf\n", clock()/(double)CLOCKS_PER_SEC);
typedef long long ll;
typedef double db;
const int inf = (int)1e9;
const ll linf = (ll)1e18;
typedef pair<int, int> pii;
typedef vector<int> vi;
#define x first
#define y second
#define pb(x) push_back(x)
#define sz(x) (int)(x).size()
template<class TAT>
inline void read(TAT &res){
char c; res = 0;
bool neg = false;
while(c = getchar(), c != '-' && (c < '0' || c > '9'));
if(c == '-') neg = true, c = getchar();
do res = (res*10) + (c^48);
while(c = getchar(), c >= '0' && c <= '9');
if(neg) res = -res;
}
template<class TAT>
inline void print(TAT x){
if(x == 0){ putchar('0'); return;}
if(x < 0){ putchar('-'); x = -x;}
static char stk[30];
int top = 0;
while(x) stk[++top] = x%10^48, x /= 10;
while(top) putchar(stk[top--]);
}
namespace Program{
const int N = 100;
const int M = 1000;
vector<pii> vec[N+5]; //[i, r) sum
int n, m;
void input(){
scanf("%d %d", &n, &m);
rep(i, 1, n+1+1) vec[i].clear();
rep(i, 0, m){
int s, t, v;
read(s); read(t); read(v);
vec[s].pb(pii(t+1, v)); //[s, t+1) v
}
}
#define all(x) (x).begin(), (x).end()
void solve(){
rep(i, 1, n+1){
sort(all(vec[i]));
vec[i].erase(unique(all(vec[i])), vec[i].end());
rep(j, 0, sz(vec[i])-1){
pii now = vec[i][j], nxt = vec[i][j+1];
if(now.x == nxt.x){ puts("false"); return;}
vec[now.x].pb(pii(nxt.x, nxt.y-now.y));
}
}
puts("true");
}
void Main(){
dig("________________________________________list\n");
input();
solve();
}
} //namespace Program
```
/\*
w cases !!!
\*/
```cpp
int main(){
#ifdef Leefir
dig("**********************define Leefir**********************\n");
freopen("data.in", "r", stdin);
freopen("data.out", "w", stdout);
#endif
int cas; scanf("%d", &cas);
while(cas--) Program::Main();
return 0;
}
```
by Leefir @ 2017-05-16 19:30:02
不能用 freopen("data.in", "r", stdin);
freopen("data.out", "w", stdout);吧
by WZTong @ 2017-05-16 19:37:21
@[Leefir](/space/show?uid=15413)
感谢反馈,数据已修复
by FlierKing @ 2017-05-16 20:47:08