【codeforces 807A】Is it rated?

【题目链接】:http://codeforces.com/contest/807/problem/A

【题意】

给你n个人在一场CF前后的rating值;
问你这场比赛是不是计分的

【题解】

如果有一个人的rating变了;
则是计分的;
否则;
按照题目所给的规则判断是maybe还是unrated;
O(N^2)

【Number Of WA

0

【完整代码】

#include <bits/stdc++.h>
using namespace std;
#define lson l,m,rt<<1
#define rson m+1,r,rt<<1|1
#define LL long long
#define rep1(i,a,b) for (int i = a;i <= b;i++)
#define rep2(i,a,b) for (int i = a;i >= b;i--)
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define ms(x,y) memset(x,y,sizeof x)

typedef pair<int,int> pii;
typedef pair<LL,LL> pll;

const int dx[9] = {0,1,-1,0,0,-1,-1,1,1};
const int dy[9] = {0,0,0,-1,1,-1,1,-1,1};
const double pi = acos(-1.0);
const int N = 1e3+100;;

int n;
int a[N],b[N];

int main()
{
    //freopen("F:\\rush.txt","r",stdin);
    ios::sync_with_stdio(false),cin.tie(0);//scanf,puts,printf not use
    cin >> n;
    rep1(i,1,n)
        cin >> a[i] >> b[i];
    rep1(i,1,n)
        if (a[i]!=b[i])
            return cout <<"rated"<<endl,0;
    rep1(i,1,n)
    {
        rep1(j,i+1,n)
            if (a[j]>a[i])
                return cout <<"unrated"<<endl,0;
    }
    cout <<"maybe"<<endl;
    return 0;
}
posted @ 2017-10-04 18:44  AWCXV  阅读(128)  评论(0编辑  收藏  举报