結果

問題 No.1 道のショートカット
ユーザー zakio_10
提出日時 2018-12-19 19:57:57
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
TLE  
実行時間 -
コード長 1,325 bytes
コンパイル時間 705 ms
コンパイル使用メモリ 69,060 KB
実行使用メモリ 10,012 KB
最終ジャッジ日時 2024-07-08 05:07:17
合計ジャッジ時間 7,274 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 4 TLE * 1 -- * 35
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
#include <string>
#include <numeric>
#define ll long long

using namespace std;

struct tga
{

 ll s;
 ll t;
 ll y;
 ll m;
};

int tagawaaaaa(ll pos);

ll countNum = 0;

ll V, C, N;

ll myTime;
ll myCost;
ll ansTime = -1;
vector<tga> vec(1);

int main()
{
 ll posi;

 cin >> N >> C >> V;

 posi = N;

 ll temochi = C;
 ll stime = 0;
 ll ans = 0;

 vec.resize(V);
 vector<ll> count(V);

 for (ll i = 0; i < V; i++)
 {
  cin >> vec[i].s;
 }
 for (ll i = 0; i < V; i++)
 {
  cin >> vec[i].t;
  count[i] = vec[i].t;
 }
 for (ll i = 0; i < V; i++)
 {
  cin >> vec[i].y;
 }
 for (ll i = 0; i < V; i++)
 {
  cin >> vec[i].m;
 }

 /*

 for (ll i = V - 1; i >= 0; i--)
 {
  if (vec[i].s == posi)
  {
   posi = vec[i].t;
   temochi -= vec[i].y;
   stime += vec[i].m;
  }
 }
 */

 tagawaaaaa(posi);

 printf("%lld\n", ansTime);

 return 0;
}

int tagawaaaaa(ll pos)
{
 if (pos == 1)
 {
  countNum++;
  if (myCost <= C)
  {
   if (ansTime == -1)
    ansTime = myTime;
   else
   {
    if (ansTime > myTime)
     ansTime = myTime;
   }
  }
  return 0;
 }
 for (ll i = 0; i < V; i++)
 {
  if (pos == vec[i].t)
  {
   if (pos == N)
   {
    myTime = 0;
    myCost = 0;
   }
   myTime += vec[i].m;
   myCost += vec[i].y;
   tagawaaaaa(vec[i].s);
  }
 }
 return 0;
}
0