/ xjjppm /

记录详情

System Error

/in/foo.cc: In function 'void input(ll&)':
/in/foo.cc:12:8: warning: variable 'a' set but not used [-Wunused-but-set-variable]
     ll a=1;char c=getchar();
        ^
/in/foo.cc: In function 'void read(int&)':
/in/foo.cc:21:9: warning: variable 'a' set but not used [-Wunused-but-set-variable]
     int a=1;char c=getchar();
         ^
/in/foo.cc: In function 'int main()':
/in/foo.cc:42:14: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
         mid=l+r>>1;
             ~^~
KeyError('config.ini',)

代码

#include<cstdio>
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long ll;
#define maxn 200010
#define maxm 200010
ll a[maxn],b[maxm],k;
int n,m;
inline void input(ll &x) {
    x=0;
    ll a=1;char c=getchar();
    for(;c<'0'||c>'9';c=getchar())
        if(c=='-') a=-1;
    for(;c>='0'&&c<='9';c=getchar())
        x=x*10+c-'0';
    return;
}
inline void read(int &x) {
    x=0;
    int a=1;char c=getchar();
    for(;c<'0'||c>'9';c=getchar())
        if(c=='-') a=-1;
    for(;c>='0'&&c<='9';c=getchar())
        x=x*10+c-'0';
    return;
}
inline bool judge(ll x) {
    ll rank=0,j=m;
    for(int i=1;i<=n;++i,rank+=j)
        while(j>=1&&a[i]*b[j]>x) j--;
    return rank<k?false:true;
}
int main() {
    read(n),read(m),input(k);
    for(int i=1;i<=n;++i) input(a[i]);
    for(int i=1;i<=m;++i) input(b[i]);
    sort(a+1,a+n+1);
    sort(b+1,b+m+1);
    ll l=0,r=a[n]*b[m],mid,ans;
    while(l<=r) {
        mid=l+r>>1;
        if(judge(mid)) {
            r=mid-1;
            ans=mid;
        } else l=mid+1;
    }
    cout<<ans;
    return 0;
}

信息

递交者
类型
递交
题目
第K小数
语言
C++
递交时间
2017-08-17 18:49:47
评测时间
2017-08-17 18:49:47
评测机
分数
0
总耗时
0ms
峰值内存
0 Bytes