답안 #908537

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
908537 2024-01-16T13:55:23 Z lighton Segway (COI19_segway) C++17
40 / 100
11 ms 6492 KB
#include<bits/stdc++.h>
#define forf(i,a,b) for(int i = a; i<=b; i++)
#define forb(i,a,b) for(int i = a; i>=b; i--)
#define all(v) v.begin(),v.end()
typedef long long ll;
using namespace std;
int N,M;
int A[1001][3];
struct ST{
    int id,time,acc;
    bool operator<(const ST &r){
        if(time ==r.time) return id<r.id;
        return time<r.time;
    }
};
vector<ST> dist[100001];
int isacc[100001];
int ans[10001];
int main(){
    scanf("%d" ,&N);
    forf(i,1,N){
        scanf("%d %d %d" , &A[i][0],&A[i][1],&A[i][2]);
    }
    scanf("%d" , &M);
    forf(i,1,M){
        int t; scanf("%d" , &t);
        isacc[t] = 1;
    }
    forf(i,1,N) dist[0].push_back({i,0,0});
    forf(i,0,299){
        int seg = i/100;
        sort(all(dist[i]));
        int cnt = 0;
        forf(j,0,N-1){
            if(j && dist[i][j-1].time == dist[i][j].time) cnt++;
            else cnt = 0;
            if(isacc[i] && dist[i][j].acc == 0) dist[i][j].acc = (j-cnt)%20;


            if(dist[i][j].acc) dist[i+1].push_back({dist[i][j].id,dist[i][j].time+1,dist[i][j].acc-1});
            else dist[i+1].push_back({dist[i][j].id,dist[i][j].time+A[dist[i][j].id][seg],0});
        }
    }
    for(auto i : dist[300]){
        ans[i.id] = i.time;
    }
    forf(i,1,N) printf("%d\n" , ans[i]);
}

Compilation message

segway.cpp: In function 'int main()':
segway.cpp:20:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   20 |     scanf("%d" ,&N);
      |     ~~~~~^~~~~~~~~~
segway.cpp:22:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   22 |         scanf("%d %d %d" , &A[i][0],&A[i][1],&A[i][2]);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
segway.cpp:24:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   24 |     scanf("%d" , &M);
      |     ~~~~~^~~~~~~~~~~
segway.cpp:26:21: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   26 |         int t; scanf("%d" , &t);
      |                ~~~~~^~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2908 KB Output is correct
2 Correct 3 ms 3932 KB Output is correct
3 Correct 11 ms 6492 KB Output is correct
4 Incorrect 2 ms 3164 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 2904 KB Output is correct
2 Correct 1 ms 2908 KB Output is correct
3 Correct 1 ms 2908 KB Output is correct
4 Correct 1 ms 2908 KB Output is correct
5 Correct 1 ms 3164 KB Output is correct
6 Correct 2 ms 3164 KB Output is correct
7 Correct 2 ms 3420 KB Output is correct
8 Correct 4 ms 3932 KB Output is correct
9 Correct 3 ms 3932 KB Output is correct
10 Correct 5 ms 4756 KB Output is correct
11 Correct 3 ms 3928 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2908 KB Output is correct
2 Correct 3 ms 3932 KB Output is correct
3 Correct 11 ms 6492 KB Output is correct
4 Incorrect 2 ms 3164 KB Output isn't correct
5 Halted 0 ms 0 KB -