답안 #77298

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
77298 2018-09-24T20:22:57 Z toreto_back 통행료 (IOI18_highway) C++14
0 / 100
142 ms 2308 KB
#include "highway.h"
#include <bits/stdc++.h>
#define F first
#define S second
using namespace std;
typedef long long ll;
typedef double D;
const ll mod=1e9+7;

vector<int>w;
int m;
void init(int x){
    for(int j=0;j<m;j++)w[j]=x;
}
void find_pair(int N, vector<int> U, vector<int> V, int A, int B) {
    int l=0,r=N-1,M=U.size(),n=N;
    int q=99;m=M;
    for(int i=0;i<m;i++)w.push_back(0);
    ll c=ask(w);
    int len=c/A;
    while(r-l+1>2*len && r-l+1-len+1>q){
//        cout<<l<<" "<<r<<endl;
        int mid=(l+r)/2;
        init(0);
        for(int i=l;i<mid;i++)w[i]=1;
        ll c1=ask(w);q--;
        if(c1==c){
            l=max(0,mid-len+1);
        }
        else r=min(mid+len-1,n-1);
    }
    ll xa=0,xb=0;
    while(!xa&&!xb && r-l+1-len+1>q){
        init(1);
        for(int i=l;i<(l+r)/2;i++)w[i]=0;
        ll c1=ask(w);q--;
        if(c1==c){
            r=(l+r)/2+1;
        }
        else if(c1==len*B){
            l=(l+r)/2-1;
        }
        else{
            c=c1;
            ll d=len,a=A,b=B;
            xb=(c-d*a)/(b-a);
            xa=d-xb;
            xa=(l+r)/2 - xa;
//            cout<<xa<<" "<<xa+len<<endl;
            answer(xa,xa+len);
            return;
        }
    }
    for(int i=l;;i++){
        init(1);
        for(int j=i;j<len+i;j++)w[j]=0;
        ll c1=ask(w);
        if(c1==c){
            answer(i,i+len);
            break;
        }
    }
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 376 KB Output is incorrect: more than 100 calls to ask.
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 260 KB Output is incorrect: more than 100 calls to ask.
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 17 ms 576 KB Output is correct
2 Correct 64 ms 840 KB Output is correct
3 Correct 37 ms 1044 KB Output is correct
4 Correct 133 ms 2300 KB Output is correct
5 Correct 142 ms 2300 KB Output is correct
6 Correct 107 ms 2308 KB Output is correct
7 Incorrect 141 ms 2308 KB Output isn't correct
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 248 KB Output is incorrect: more than 100 calls to ask.
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 33 ms 600 KB Output is incorrect: more than 100 calls to ask.
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 31 ms 568 KB Output is incorrect: more than 100 calls to ask.
2 Halted 0 ms 0 KB -