답안 #168618

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
168618 2019-12-14T10:35:56 Z ahmet Segway (COI19_segway) C++14
100 / 100
738 ms 1572 KB
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,n) for(long long (i)=0;(i)<(n);++(i))
#define ref(i,a,b) for (long long (i)=(a); (i)<=(b); ++(i))
#define endl '\n'
#define st first
#define nd second
#define pb push_back
#define mp make_pair
const int mx=1e5+5;
int n,m,speed1[20001],speed2[20001],speed3[20001];
bool acc[301];
int ans[20001],gidilecek_yol[20001];
bool hala_acc_da_mi[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];
        ans[i]=0;
        gidilecek_yol[i]=0;
    }
    cin >> m;
    int t;
    for(int i=0;i<m;i++)
    {
       cin >> t;
       acc[t]=1;//acc varsa 1
    }
    for(int i=1;i<=300;i++)
    {
      for(int j=0;j<n;j++)
      {
         if(hala_acc_da_mi[j])
         {
             ans[j]++;
             gidilecek_yol[j]--;
             if(gidilecek_yol[j]<=0)hala_acc_da_mi[j]=0;
         }
         else
         {
             if(i<=100)ans[j]+=speed1[j];
             else if(i<=200)ans[j]+=speed2[j];
             else
             {
                 ans[j]+=speed3[j];
             }
         }
      }
      if(acc[i])
      {
        vector<pair<int,int> >temp;
        for(int j=0;j<n;j++)
        {
           temp.push_back(make_pair(ans[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(hala_acc_da_mi[pos] || previ%20==0)continue;
            hala_acc_da_mi[pos]=1;
            gidilecek_yol[pos]=previ%20;
        }
      }
    }
    for(int i=0;i<n;i++)
    {
        cout << ans[i] <<	endl;
    }
    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 18 ms 1276 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 380 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 3 ms 376 KB Output is correct
8 Correct 3 ms 376 KB Output is correct
9 Correct 3 ms 376 KB Output is correct
10 Correct 3 ms 376 KB Output is correct
11 Correct 6 ms 380 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 18 ms 1276 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 380 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 3 ms 376 KB Output is correct
13 Correct 3 ms 376 KB Output is correct
14 Correct 3 ms 376 KB Output is correct
15 Correct 3 ms 376 KB Output is correct
16 Correct 6 ms 380 KB Output is correct
17 Correct 3 ms 376 KB Output is correct
18 Correct 56 ms 504 KB Output is correct
19 Correct 105 ms 844 KB Output is correct
20 Correct 32 ms 968 KB Output is correct
21 Correct 200 ms 1184 KB Output is correct
22 Correct 498 ms 1396 KB Output is correct
23 Correct 738 ms 1572 KB Output is correct