比赛 |
不平凡的世界 |
评测结果 |
WAWWWWWWWW |
题目名称 |
不平凡的boss |
最终得分 |
10 |
用户昵称 |
pppoooiiizzy |
运行时间 |
0.487 s |
代码语言 |
C++ |
内存使用 |
1.31 MiB |
提交时间 |
2015-11-05 11:00:32 |
显示代码纯文本
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<queue>
#include<vector>
#include<functional>
#include<set>
#include<map>
#include<deque>
#include<list>
#include<ctime>
#include<cstdlib>
#include<string>
#include<sstream>
#include<iomanip>
const int maxn = 100000 + 100;
using namespace std;
#define rep(i, j, k) for(int i = j; i <= k; i++)
#define drep(i, j, k) for(int i = j; i >= k; i--)
#define INF 0x3fffffff
#define LL long long
inline int read()
{
int x = 0, f = 1;
char ch = getchar();
while(ch < '0' || ch > '9') {if(ch == '-') f = -1; ch = getchar(); }
while(ch >= '0' && ch <= '9') {x = x * 10 + ch - '0'; ch = getchar();}
return x * f;
}
int get_min(int a, int b, int c)
{
int temp = INF;
temp = min(a, temp); temp = min(b, temp); temp = min(c, temp);
return temp;
}
struct mosnter {
int x, y, z;
}a[maxn];
int n, m, cost, Ar, Sa;
int sum, tot, ans, cnt;
int Pa, Pb, Pc;
void init()
{
n = read();
rep(i, 1, n) {
a[i].x = read(), a[i].y = read(), a[i].z = read();
}
}
int main()
{
freopen("playwithboss.in", "r", stdin);
freopen("playwithboss.out", "w", stdout);
init();
for(int i = 1; i <= n; i++) {
int M = get_min(a[i].x, a[i].y, a[i].z);
if(Pa >= a[i].x || Pb >= a[i].y || Pc >= a[i].z) {continue;}
if(M == a[i].y)
if(Pb >= M) continue;
else {ans += M - Pb, Pb = M; continue;}
if(M == a[i].x)
if(Pa >= M) continue;
else {ans += M - Pa, Pa = M; continue;}
if(M == a[i].z)
if(Pc >= M) continue;
else {ans += M - Pc, Pc = M; continue;}
}
cout<<ans<<endl;
}