답안 #696319

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
696319 2023-02-06T08:16:01 Z stevancv Collecting Stamps 3 (JOI20_ho_t3) C++14
0 / 100
0 ms 212 KB
// GPT TESTING
#include <bits/stdc++.h>
using namespace std;
const int N=210;
int n,l,cnt,ans,x[N],t[N];
bool cmp(int a,int b){
    return t[a]<t[b];
}
int main(){
    scanf("%d%d",&n,&l);
    for(int i=0;i<n;i++){
        scanf("%d",&x[i]);
        x[i+n]=x[i]+l;
    }
    for(int i=0;i<n;i++){
        scanf("%d",&t[i]);
    }
    for(int i=0;i<n;i++){
        cnt=0;
        vector<int>v;
        for(int j=0;j<n*2;j++){
            int tmp=(j+i)%n;
            if(x[j]<=x[i]+t[i]){
                cnt++;
                v.push_back(tmp);
            }
        }
        ans=max(ans,cnt);
        for(int j=0;j<cnt-1;j++){
            if(x[v[j+1]+n]-x[v[j]]>t[v[j]]){
                ans=max(ans,j+1);
                break;
            }
        }
    }
    printf("%d\n",ans);
    return 0;
}

Compilation message

ho_t3.cpp: In function 'int main()':
ho_t3.cpp:10:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   10 |     scanf("%d%d",&n,&l);
      |     ~~~~~^~~~~~~~~~~~~~
ho_t3.cpp:12:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |         scanf("%d",&x[i]);
      |         ~~~~~^~~~~~~~~~~~
ho_t3.cpp:16:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   16 |         scanf("%d",&t[i]);
      |         ~~~~~^~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -