답안 #753833

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
753833 2023-06-06T07:09:11 Z Luca7 Boat (APIO16_boat) C++17
0 / 100
602 ms 524288 KB
#include <fstream>
#include<vector>
#pragma GCC optimize("O3","unroll-loops")
using namespace std;

#define limit 1000000007
typedef long long ll;

ifstream cin("boat.in");
ofstream cout("boat.out");

struct School {
    ll a, b;
};
vector<School> schools;

ll res = 0;
void solve(ll n, ll i,ll minn) {
    if (i == n) {
        res++;
        if (res == limit)
            res = 0;
        return;
    }

    solve(n, i + 1, minn);
    for (int j = max(minn, schools[i].a); j <= schools[i].b; j++) {
        solve(n, i + 1, j + 1);
    }

}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    /*cout << "500\n";
    for (int i = 0; i < 500; i++) {
        cout << "5 5\n";
    }
    
    return 0;*/
    ll i, j, nr, n,a,b;

    cin >> n;
    for (i = 0; i < n; i++) {
        cin >> a >> b;
        schools.push_back({a,b});
    }
    
    solve(n, 0, 0);
    res--;
    if (res == -1) {
        res = limit;
    }
    cout << res;

    return 0;
}

Compilation message

boat.cpp: In function 'int main()':
boat.cpp:45:11: warning: unused variable 'j' [-Wunused-variable]
   45 |     ll i, j, nr, n,a,b;
      |           ^
boat.cpp:45:14: warning: unused variable 'nr' [-Wunused-variable]
   45 |     ll i, j, nr, n,a,b;
      |              ^~
# 결과 실행 시간 메모리 Grader output
1 Runtime error 602 ms 524288 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 602 ms 524288 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 586 ms 524288 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 602 ms 524288 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -