답안 #1097427

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1097427 2024-10-07T09:51:33 Z StefanSebez Semiexpress (JOI17_semiexpress) C++14
18 / 100
1 ms 600 KB
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define ll long long
#define ld long double
int main(){
    int n,m,K;scanf("%i%i%i",&n,&m,&K);
    K-=m;
    ll A,B,C;scanf("%lld%lld%lld",&A,&B,&C);
    ll T;scanf("%lld",&T);
    ll a[m+10];for(int i=1;i<=m;i++) scanf("%lld",&a[i]);
    ll ind[m+10];
    set<pair<int,int>>st;
    ll res=0;
    for(int i=1;i<=m;i++){
        ind[i]=a[i];
        /*ll x=B*(a[i]-a[1]);
        //(j-ind[i])*A+(ind[i]-a[i])*C+(a[i]-a[1])*B<=T
        ll j=(T-(ind[i]-a[i])*C-(a[i]-a[1])*B)/A;
        j=min(j,a[i+1]);
        res+=j-ind[i]+1;
        if(j<a[i+1]) st.insert({j-a[i],i});*/
        if((a[i]-a[1])*B<=T) res++;
    }
    //printf("%lld\n",m);
    for(int i=1;i<m&&K>0;K--){
        if(T-(ind[i]-a[i])*C-(a[i]-a[1])*B<0){i++;continue;}
        if(ind[i]==a[i]) {res--;K++;}
        ll j=(T-(ind[i]-a[i])*C-(a[i]-a[1])*B)/A+ind[i];
        j=min(j,a[i+1]-1);
        //printf("%i: %lld %lld %lld %lld %lld\n",i,j,ind[i],(ind[i]-a[i]),(a[i]-a[1]),T-(ind[i]-a[i])*C-(a[i]-a[1])*B);
        res+=j-ind[i]+1;
        ind[i]=j+1;
        if(ind[i]==a[i+1]) i++;
    }
    res--;
    printf("%lld\n",res);
    return 0;
}

Compilation message

semiexpress.cpp: In function 'int main()':
semiexpress.cpp:9:20: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    9 |     int n,m,K;scanf("%i%i%i",&n,&m,&K);
      |               ~~~~~^~~~~~~~~~~~~~~~~~~
semiexpress.cpp:11:19: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |     ll A,B,C;scanf("%lld%lld%lld",&A,&B,&C);
      |              ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
semiexpress.cpp:12:15: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |     ll T;scanf("%lld",&T);
      |          ~~~~~^~~~~~~~~~~
semiexpress.cpp:13:43: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |     ll a[m+10];for(int i=1;i<=m;i++) scanf("%lld",&a[i]);
      |                                      ~~~~~^~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 1 ms 600 KB Output is correct
14 Incorrect 1 ms 348 KB Output isn't correct
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 1 ms 600 KB Output is correct
14 Incorrect 1 ms 348 KB Output isn't correct
15 Halted 0 ms 0 KB -