Submission #148287

# Submission time Handle Problem Language Result Execution time Memory
148287 2019-08-31T20:46:38 Z JovanK26 Segway (COI19_segway) C++14
0 / 100
2 ms 504 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])
         {
             //cout <<"reeeee"<<endl;
             timee[j]++;
             due[j]--;
             if(!due[j])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());
        for(int j=1;j<n;j++)
        {
            int pos=temp[j].second;
            if(is[pos])continue;
            is[pos]=1;
            due[pos]=j%20;
        }
      }
    }
    for(int i=0;i<n;i++)
    {
        cout << timee[i]<<'\n';
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 504 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Incorrect 2 ms 376 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 504 KB Output isn't correct
2 Halted 0 ms 0 KB -