답안 #1041530

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1041530 2024-08-02T05:17:37 Z vjudge1 Segway (COI19_segway) C++17
0 / 100
2 ms 348 KB
#include<bits/stdc++.h>

using namespace std;

const int N = 20'000 + 10;
int n, sp[N][3], t[N], boost[N];
bool a[300];

int main()
{
  cin >> n;
  for(int i = 1; i <= n; i ++)
    for(int j = 0; j < 3; j++)
      cin >> sp[i][j];

  int m;
  cin >> m;
  for(int i = 0; i < m; i ++)
    {
      int x;
      cin >> x;
      a[x] = true;
    }

  
  for(int d = 0; d < 300; d ++)
    {
      vector<pair<int,int> > st;
      for(int i = 1; i <= n; i++)
	st.push_back({t[i], i});

      sort(st.begin(), st.end());
      vector<int> ahead(n);
      for(int i = 1; i < n; i ++)
	ahead[i] = (ahead[i - 1] + (st[i].first != st[i - 1].first)) % 20;

      for(int i = 0; i < n; i ++)
	{

	  int cur = st[i].second;

	  if(a[d] && !boost[cur])
	    {
	      // cerr << "cur = " << cur << ' ' << ahead[i] << endl;  
	      boost[cur] = ahead[i];
	    }
	  
	  if(boost[cur])
	    {
	      t[cur]++, boost[cur]--;
	      // if(cur == 1)
	      //	cout << d  << "acc of 1"<< endl;
	    }
	  else
	    {
	      // if(cur == 1)
	      //	cout << d << " wacc of 1" << endl;
	      t[cur] += sp[cur][d / 100];
	    }


	}
      
    }

  for(int i = 1; i <= n; i ++)
    cout << t[i] << "\n";
 
  return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 2 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 2 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -