Submission #20377

# Submission time Handle Problem Language Result Execution time Memory
20377 2017-02-07T10:00:35 Z 채점 시스템 (OJUZ11_judge) C++14
100 / 100
49 ms 540 KB
/*#include<stdio.h>
#include<algorithm>
using namespace std;
int w[101000];
struct point{
    int t, num, c;
}P[101000];
int n, m, Mn[101000], Mx[101000], S[101000], C1[101000], C2[101000], G[101000], chk[101000];
bool Pos(int K){
    int i, rem = 0;
    for(i=1;i<=n;i++)Mn[i] = 1e9, Mx[i] = 0;
    for(i=1;i<=m;i++)C1[i] = C2[i] = 0, G[i] = 0, chk[i] = 0, S[i] = 0;
    chk[m+1] = 1;G[m+1]=G[0]=0;
    for(i=1;i<=K;i++){
        Mx[P[i].num] = max(Mx[P[i].num], P[i].t);
        Mn[P[i].num] = min(Mn[P[i].num], P[i].t);
        if(G[P[i].t] && G[P[i].t] != P[i].c)return false;
        G[P[i].t] = P[i].c;
        chk[P[i].t] = 1;
    }
    for(i=1;i<=m;i++){
        if(!Mx[i]){
            rem++;
        }
        else{
            S[Mn[i]]++, S[Mx[i]+1]--;
            C1[Mn[i]-1]++;
            C2[Mx[i]+1]++;
        }
    }
    for(i=1;i<=m;i++){
        S[i] += S[i-1];
        if(chk[i] && S[i] > G[i])return false;
    }
    for(i=1;i<=m;i++){
        G[i] -= S[i];
    }
    int t = 0;
    for(i=m;i>=1;i--){
        t +=C1[i];
        if(chk[i]){
            t = min(t,G[i]);
            G[i] -= t;
        }
    }
    t = 0;
    for(i=1;i<=m;i++){
        t +=C2[i];
        if(chk[i]){
            t = min(t,G[i]);
            G[i] -= t;
        }
    }
    t = 0;
    rem *= 2;
    for(i=1;i<=m;i++){
        if(chk[i]){
            rem -= (t-G[i]<0?G[i]-t:t-G[i]);
            t = G[i];
            if(rem<0)return false;
        }
    }
    return true;
}
int main(){
    int i, TC;
    scanf("%d",&TC);
    while(TC--){
        scanf("%d%d",&n,&m);
        for(i=1;i<=m;i++){
            scanf("%d%d%d",&P[i].t,&P[i].num,&P[i].c);
            P[i].c++;
        }
        int b = 1, e = m, mid, res = 0;
        while(b<=e){
            mid = (b+e)>>1;
            if(Pos(mid)){
                res = mid;
                b = mid + 1;
            }
            else e = mid - 1;
        }
        printf("%d\n",res);
    }
}*/
/*#include<cstdio>
#include<algorithm>
using namespace std;
int n, L, cnt;
struct point{
    long long x, y;
    int ck;
}w[301000];
int st[301000];
long long ccw(point a, point b, point c){
    return (b.x-a.x)*(c.y-a.y)-(b.y-a.y)*(c.x-a.x);
}
double Get(point a, point b){
    return b.x - 1.0*b.y/(b.y-a.y)*(b.x-a.x);
}
struct AA{
    double x;
    int c = 0;
    bool operator<(const AA &p)const{
        return x<p.x;
    }
}ord[1201000];
void Add(double b, double e, int ck){
    if(ck){
        swap(b,e);
        b=L-b,e=L-e;
    }
    ord[cnt].x = b, ord[cnt].c = 1, cnt++;
    ord[cnt].x = e, ord[cnt].c = -1, cnt++;
}
void Do(int ck){
    int top = 0, i;
    st[++top] = 0;
    for(i=1;i<=n;i++){
        double tx = w[i-1].x;
        while(top > 1){
            double x = Get(w[st[top-1]], w[st[top]]);
            if(x > w[i].x)break;
            if(w[st[top]].ck){
                Add(tx,w[i].x,ck);
                tx = w[i].x;
                top--;
                break;
            }
            tx = x;
            top--;
        }
        if(w[st[top]].ck)Add(tx,w[i].x,ck);
        while(top > 1 && ccw(w[st[top-1]], w[st[top]], w[i]) >= 0) top--;
        while(top && w[st[top]].y <= w[i].y)top--;
        st[++top] = i;
    }
}
int main(){
    int i, s = 0;
    double res = 0.0;
    scanf("%d%d",&n,&L);
    for(i=1;i<=n;i++){
        scanf("%d%lld%lld",&w[i].ck,&w[i].x,&w[i].y);
    }
    n++;
    w[n].x = L;
    Do(0);
    for(i=0;i<=n/2;i++)swap(w[i],w[n-i]);
    for(i=0;i<=n;i++)w[i].x=L-w[i].x;
    Do(1);
    sort(ord,ord+cnt);
    for(i=0;i<cnt-1;i++){
        s += ord[i].c;
        if(s)res += ord[i+1].x-ord[i].x;
    }
    printf("%.9f\n",res);
}*/
#include<cstdio>
int main(){
    int TC;
    scanf("%d",&TC);
    long long A, B, T;
    while(TC--){
        int i, c = 0;
        scanf("%lld%lld",&A,&B);
        T=1;
        for(;;){
            T*=10;
            if(T+A > B)break;
            if(T>A)c++;
        }
        printf("%d\n",c);
    }
}

Compilation message

judge.cpp: In function 'int main()':
judge.cpp:165:13: warning: unused variable 'i' [-Wunused-variable]
         int i, c = 0;
             ^
judge.cpp:162:20: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d",&TC);
                    ^
judge.cpp:166:32: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%lld%lld",&A,&B);
                                ^
# Verdict Execution time Memory Grader output
1 Correct 33 ms 416 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 33 ms 416 KB Output is correct
2 Correct 39 ms 440 KB Output is correct
3 Correct 40 ms 472 KB Output is correct
4 Correct 37 ms 472 KB Output is correct
5 Correct 49 ms 472 KB Output is correct
6 Correct 38 ms 472 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 33 ms 416 KB Output is correct
2 Correct 39 ms 440 KB Output is correct
3 Correct 40 ms 472 KB Output is correct
4 Correct 37 ms 472 KB Output is correct
5 Correct 49 ms 472 KB Output is correct
6 Correct 38 ms 472 KB Output is correct
7 Correct 44 ms 472 KB Output is correct
8 Correct 48 ms 540 KB Output is correct
9 Correct 43 ms 540 KB Output is correct
10 Correct 43 ms 540 KB Output is correct
11 Correct 36 ms 540 KB Output is correct