답안 #250368

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
250368 2020-07-17T15:45:21 Z AmirElarbi Semiexpress (JOI17_semiexpress) C++14
0 / 100
1000 ms 360 KB
// mainn.cpp : Ce fichier contient la fonction 'main'. L'exécution du programme commence et se termine à cet endroit.
//

#include <bits/stdc++.h>
using namespace std;
#define vi vector<int>
#define vl vector<long>
#define pb push_back
int main()
{
    int n, m, k;
    cin >> n >> m >> k;
    int a, b, c;
    cin >> a >> b >> c;
    int T;
    vector<int> s;
    cin >> T;
    for (int i = 0; i < m; i++)
    {
        int si;
        cin >> si;
        s.push_back(si);
    }
    vector<int> ks;
    for (int i = 0; i < m; i++) {
        ks.push_back(s[i]);
    }
    int ans = 0;
    for(int l = 2; l < n; l++){
        for (int r = l+1; r < n; r++) {
            vector<int> test = ks;
            test.push_back(l);
            test.push_back(r);
            sort(test.begin(), test.end());
            int res = 0;
            for (int stion = 2; stion <= n; stion++) {
                int time = 0;
                int current = 1;
                int i = 1;
                int j = 1;
                while (current != stion) {
                    while (current >= s[i] && i < s.size()) i++;
                    while (current >= test[j] && j < test.size()) j++;
                    if (s[i] <= stion && current == s[(int)i - 1] && i < s.size()) {
                        time += (s[i] - current) * b;
                        current = s[i];
                        i++;
                    }
                    else if (test[j] <= stion && current == test[j - 1] && j < test.size()) {
                        time += (test[j] - current) * c;
                        current = test[j];
                        j++;
                    }
                    else if (current) {
                        time += a;
                        current++;
                    }
                } 
                if (time <= T) res++;
            }
            ans = max(ans, res);
            
        }
    }
    cout << ans;
}

Compilation message

semiexpress.cpp: In function 'int main()':
semiexpress.cpp:42:49: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
                     while (current >= s[i] && i < s.size()) i++;
                                               ~~^~~~~~~~~~
semiexpress.cpp:43:52: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
                     while (current >= test[j] && j < test.size()) j++;
                                                  ~~^~~~~~~~~~~~~
semiexpress.cpp:44:72: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
                     if (s[i] <= stion && current == s[(int)i - 1] && i < s.size()) {
                                                                      ~~^~~~~~~~~~
semiexpress.cpp:49:78: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
                     else if (test[j] <= stion && current == test[j - 1] && j < test.size()) {
                                                                            ~~^~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 896 ms 360 KB Output is correct
2 Execution timed out 1048 ms 360 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 896 ms 360 KB Output is correct
2 Execution timed out 1048 ms 360 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 896 ms 360 KB Output is correct
2 Execution timed out 1048 ms 360 KB Time limit exceeded
3 Halted 0 ms 0 KB -