답안 #148293

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
148293 2019-08-31T21:49:51 Z JovanK26 Segway (COI19_segway) C++14
100 / 100
733 ms 1592 KB
#include <bits/stdc++.h>

using namespace std;
int n,m;
int speed1[20001];
int speed2[20001];
int speed3[20001];
bool seg[301];
int timee[20001];
int due[20001];
bool is[20001];
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin >> n;
    for(int i=0;i<n;i++)
    {
        cin >> speed1[i] >> speed2[i]>>speed3[i];
        timee[i]=0;
        due[i]=0;
    }
    cin >> m;
    int t;
    for(int i=0;i<m;i++)
    {
       cin >> t;
       seg[t]=1;
    }
    for(int i=1;i<=300;i++)
    {
      for(int j=0;j<n;j++)
      {
         if(is[j])
         {
             timee[j]++;
             due[j]--;
             if(due[j]<=0)is[j]=0;
         }
         else
         {
             if(i<=100)timee[j]+=speed1[j];
             else if(i<=200)timee[j]+=speed2[j];
             else
             {
                 timee[j]+=speed3[j];
             }
         }
      }
      if(seg[i])
      {
        vector<pair<int,int> >temp;
        for(int j=0;j<n;j++)
        {
           temp.push_back(make_pair(timee[j],j));
        }
        sort(temp.begin(),temp.end());
        int previ=0;
        for(int j=1;j<n;j++)
        {
            if(temp[j].first!=temp[previ].first)previ=j;
            int pos=temp[j].second;
            if(is[pos] || previ%20==0)continue;
            is[pos]=1;
            due[pos]=previ%20;
        }
      }
    }
    for(int i=0;i<n;i++)
    {
        cout << timee[i]<<'\n';
    }
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 3 ms 376 KB Output is correct
4 Correct 5 ms 504 KB Output is correct
5 Correct 19 ms 1272 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 3 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 3 ms 376 KB Output is correct
9 Correct 4 ms 376 KB Output is correct
10 Correct 3 ms 376 KB Output is correct
11 Correct 6 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 3 ms 376 KB Output is correct
4 Correct 5 ms 504 KB Output is correct
5 Correct 19 ms 1272 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
11 Correct 3 ms 376 KB Output is correct
12 Correct 2 ms 376 KB Output is correct
13 Correct 3 ms 376 KB Output is correct
14 Correct 4 ms 376 KB Output is correct
15 Correct 3 ms 376 KB Output is correct
16 Correct 6 ms 376 KB Output is correct
17 Correct 3 ms 428 KB Output is correct
18 Correct 56 ms 504 KB Output is correct
19 Correct 106 ms 908 KB Output is correct
20 Correct 31 ms 932 KB Output is correct
21 Correct 201 ms 1240 KB Output is correct
22 Correct 498 ms 1588 KB Output is correct
23 Correct 733 ms 1592 KB Output is correct