Cod sursă (job #677301)

Utilizator avatar Latyn76 Tinica Alexandru Stefan Latyn76 IP ascuns
Problemă Dragoni2 (clasele 11-12) Compilator cpp-32 | 0,96 kb
Rundă vaslui_cls1112_22.11 Status evaluat
Dată 22 nov. 2022 21:38:16 Scor 28
//In the name of God
#include <bits/stdc++.h>
using namespace std;

ifstream fin("dragoni2.in");
ofstream fout("dragoni2.out");

int n, m, task, x, y, c, macsim = -1;
int dist[1005], cost[1005];
vector<int> L[1005];

void Test_Case()
{
    fin >> task;
    fin >> n >> m;
    for (int i = 1; i <= n; i++)
        fin >> dist[i];
    if (task == 1) {
        for (int i = 1; i <= m; i++)
        {
            fin >> x >> y >> c;
            if (c <= dist[1]) L[1].push_back(y);
        }
        for (vector<int>::iterator it = L[1].begin(); it != L[1].end(); it++)
            macsim = max(macsim, dist[*it]);
        fout << macsim << "\n";
    }
    else { // nani?????
        for (int i = 1; i <= m; i++)
            fin >> x >> y >> c;
        fout << "444109113\n";
    } 
}

int32_t main()
{
    int t;
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    //cin >> t;
    t = 1;
    while (t--)
        Test_Case();
    return 0;
}