QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#459001 | #8829. Aibohphobia | ucup-team3474# | WA | 1ms | 3784kb | C++23 | 1.6kb | 2024-06-29 21:13:59 | 2024-06-29 21:13:59 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std ;
void solve()
{
int n = 5 ;
vector<int> p(n);
iota(p.begin(),p.end(),0);
do
{
int z = 0 ;
vector<int> vis(n , 0) ;
function<void(int)> dfs = [&](int u)
{
z += 1 ;
vis[u] = 1 ;
if(vis[p[u]] == 0) dfs(p[u]) ;
} ;
dfs(0) ;
if(z != n) continue ;
int t = 0 ;
for(int i = 1 ; i < (1 << n) - 1 ; i ++)
{
vector<int> id ;
vector<int> id2 ;
for(int j = 0 ; j < n ; j ++)
if((i >> j) & 1) id.push_back(j) ;
else id2.push_back(j) ;
int cnt = 0 ;
vector<int> q(n) ;
auto go = [&](vector<int> id)
{
vector<int> t = id ;
sort(id.begin(),id.end(),[&](int x , int y)
{
return p[x] < p[y] ;
});
int m = t.size() ;
sort(t.begin() , t.end()) ;
for(int i = 0 ; i < m ; i ++)
{
q[t[i]] = p[id[i]] ;
}
} ;
go(id);
go(id2);
for(int i = 0 ; i < n ; i ++) if(q[i] == i) cnt += 1 ;
t = max(t , cnt) ;
}
assert(t >= n - 2 and t != n - 1) ;
} while(next_permutation(p.begin(),p.end()));
}
int main()
{
std::ios::sync_with_stdio(false) , cin.tie(0) ;
int T = 1 ;
while (T --) solve() ;
return 0 ;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3784kb
input:
5 a sos abba icpc tenet
output:
result:
wrong output format Unexpected end of file - token expected (test case 1)