QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#701897 | #7706. Rikka with Linker | TheZone | Compile Error | / | / | C++17 | 707b | 2024-11-02 14:53:00 | 2024-11-02 14:53:29 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,s,t) for(int i=(s),_t=(t); i<=_t; ++i)
const int N=19;int f[1<<N|5];int g[N],h[1<<N|5];void solve() {int n,m;
cin >> n >> m;FOR(i,0,n-1) g[i]=0;FOR(i,1,m) {int x,y;cin >> x >> y;--x,--y;g[x]|=1<<y;}FOR(i,0,(1<<n)-1) f[i]=1e9;f[0]=0;FOR(i,0,(1<<n)-1) {
FOR(j,0,n-1) h[1<<j]=1;
FOR(j,0,n-1) if((1<<j)&i) {
h[g[j]^(g[j]&i)]++;
}
FOR(j,0,n-1) if(!((1<<j)&i)) {
f[i|(1<<j)]=min(f[i|(1<<j)],h[1<<j]+f[i]);}
cout << f[(1<<n)-1] << '\n';
}
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int T;
cin >> T;
while(T--) solve();
return 0;
}
详细
answer.code: In function ‘void solve()’: answer.code:14:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse] 14 | int main() { | ^~ answer.code:14:9: note: remove parentheses to default-initialize a variable 14 | int main() { | ^~ | -- answer.code:14:9: note: or replace parentheses with braces to value-initialize a variable answer.code:14:12: error: a function-definition is not allowed here before ‘{’ token 14 | int main() { | ^ answer.code:21:2: error: expected ‘}’ at end of input 21 | } | ^ answer.code:4:62: note: to match this ‘{’ 4 | const int N=19;int f[1<<N|5];int g[N],h[1<<N|5];void solve() {int n,m; | ^