2 条题解

  • 2
    @ 2025-6-1 13:49:22

    该死的oj最后卡死让我没改换long long痛失100!

    using namespace std;
    const int M=1e6+1;
    long long ans,L,N,vs,vj,tim;
    struct node {
    	int t,v;
    } a[M];
    bool cmp(node a,node b) {
    	return a.v>b.v;
    }
    int main() {
    	cin>>L>>N>>vs>>vj;
    	for(int i=1; i<=N; i++) {
    		int p;
    		cin>>p>>a[i].v;
    		a[i].t=p*(vs-vj);
    	}
    	sort(a+1,a+N+1,cmp);
    	for(int i=1; i<=N; i++) {
    		if(tim<=a[i].t) {
    			ans+=(a[i].t-tim)*a[i].v;
    			tim=a[i].t;
    		}
    	}
    	cout<<ans;
    }
    
    
    • @ 2025-6-4 14:16:40

      +1

    • @ 2025-6-4 15:23:13

      +1 该死的oj最后卡死让我交不上删了调试的代码 痛失100

    • @ 2025-6-6 20:07:03

      能不能不要有这种没有任何解释的题解?

信息

ID
987
时间
1000ms
内存
256MiB
难度
8
标签
递交数
258
已通过
32
上传者