| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 | 
|---|---|---|---|---|---|---|---|
| 367434 | cpp219 | Geppetto (COCI15_geppetto) | C++14 | 3 ms | 492 KiB | 
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define ll int
#define ld long double
#define fs first
#define sc second
using namespace std;
const ll N = 20 + 9;
const ll inf = 1e9 + 7;
typedef pair<int,int> LL;
vector<ll> g[N];
ll n,m,x,y,dd[N][N],ans,b[N];
void f(ll i){
    if (i > n){
        ans++; return;
    }
    b[i] = 0; f(i + 1);
    for (auto j : g[i]) if (b[j]) return;
    b[i] = 1; f(i + 1);
}
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    #define task "tst"
    if (fopen(task".INP","r")){
        freopen(task".INP","r",stdin);
        //freopen(task".OUT","w",stdout);
    }
    cin>>n>>m;
    while(m--){
        cin>>x>>y;
        if (dd[x][y]) continue;
        dd[x][y] = dd[y][x] = 1;
        g[max(x,y)].push_back(min(x,y));
    }
    f(1); cout<<ans;
}
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
