QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#912376 | #403. Memory2 | modwwe | 100 ✓ | 1ms | 3992kb | C++23 | 3.2kb | 2025-02-23 15:42:00 | 2025-02-23 15:42:01 |
Judging History
answer
//#include "gap.h"
//#include "mushrooms.h"
//#include "prize.h"
#include "Memory2_lib.h"
#pragma GCC optimize("Ofast,unroll-loops")
#include<bits/stdc++.h>
//#define int long long
#define ll long long
#define down cout<<'\n';
#define debug cout<<" cucuucucuuu",down
#define modwwe int t;cin>>t; while(t--)
#define bit(i,j) (i>>j&1)
#define sobit(a) __builtin_popcountll(a)
#define task2 "ftree"
#define task "test"
#define fin(x) freopen(x".inp","r",stdin)
#define fou(x) freopen(x".out","w",stdout)
#define pb push_back
#define mask(k) (1<<k)
#define checktime cerr << (double)clock() / CLOCKS_PER_SEC * 1000 << " ms";
using namespace std;
#define getchar_unlocked getchar
mt19937 rd(chrono::steady_clock::now().time_since_epoch().count());
int rand(int l,int r)
{
return uniform_int_distribution<int>(l,r)(rd);
}
void phongbeo();
const int inf = 1e16;
const ll mod2 = 1e9+7;
const ll base=67;
int n, m, s1, s2, s4, s3, sf, k, s5, s6, mx, s7, s8, s9, mx2, res, dem2 = 0, dem = 0, s33, dem3, dem4, mid, l2, r2, center;
int i, s10, s12,k1,k2,k3,s11,lim,w,l,r,dem5,dem6,dem7,dem9;
int kk;
int t;
int el = 19;/*
main()
{
if(fopen(task2".inp","r"))
{
fin(task2);
fou(task2);
}
if(fopen(task".inp","r"))
{
fin(task);
fou(task);
}
ios_base::sync_with_stdio(0);
cout.tie(0);
cin.tie(0);
/// cin>>s1;
//int t;cin>>t; while(t--)
phongbeo();
checktime
}*/
int c[101][101];
vector<int> per,h,v[10001],rex;
/*void Answer(int x,int y,int z)
{
dem++;
if(h[x]!=z||h[y]!=z)
{
exit(0);
}
}
int Flip(int x,int y)
{
///if(x==y) assert(0);
dem5++;
if(per[h[x]]<per[h[y]])return h[x];
return h[y];
}*/
int flip(int x,int y)
{
if(c[x][y]==-1)
{
c[x][y]=Flip(x,y);
c[y][x]=c[x][y];
}
return c[x][y];
}
void go()
{
for(int i=0; i<rex.size(); i++)
{
int maxx=-1;
int minn=1000;
for(int j=0; j<rex.size(); j++)
if(i^j)
{
int x=flip(rex[i],rex[j]);
maxx=max(maxx,x);
minn=min(minn,x);
}
if(maxx==minn)
{
v[maxx].pb(rex[i]);
swap(rex[i],rex.back());
rex.pop_back();
return;
}
}
}
void Solve(int T,int N)
{
n=N*2;
memset(c,-1,sizeof c);
if(n==2)
{
Answer(0,1,0);
}
else
{
rex.pb(0);
rex.pb(1);
rex.pb(2);
for(int i=3; i<n; i++)
rex.pb(i),go();
go();
Answer(rex[0],rex[1],flip(rex[0],rex[1]));
for(int i=0; i<n; i++)
if(v[i].size()!=0)
Answer(v[i][0],v[i][1],i);
}
}/*
void phongbeo()
{
cin>>m;
cin>>n>>k;
for(int i=0; i<n; i++)
{
cin>>s2;
per.pb(s2);
}
// shuffle(per.begin(),per.end(),rd);
// for(int i=0; i<n; i++)
// h.pb(i),h.pb(i);
//shuffle(h.begin(),h.end(),rd);
//down
for(int i=0; i<n*2; i++)
{
cin>>s2;
h.pb(s2);
}
Solve(1,n);
down
cout<<dem<<" "<<dem5<<"\n";
}
*/
Details
Subtask #1:
score: 10
Accepted
Test #1:
score: 10
Accepted
time: 1ms
memory: 3968kb
Test #2:
score: 10
Accepted
time: 0ms
memory: 3908kb
Test #3:
score: 10
Accepted
time: 0ms
memory: 3956kb
Test #4:
score: 10
Accepted
time: 1ms
memory: 3888kb
Test #5:
score: 10
Accepted
time: 1ms
memory: 3988kb
Test #6:
score: 10
Accepted
time: 0ms
memory: 3960kb
Test #7:
score: 10
Accepted
time: 1ms
memory: 3992kb
Test #8:
score: 10
Accepted
time: 1ms
memory: 3960kb
Subtask #2:
score: 50
Accepted
Test #9:
score: 50
Accepted
time: 1ms
memory: 3848kb
Test #10:
score: 50
Accepted
time: 1ms
memory: 3924kb
Test #11:
score: 50
Accepted
time: 1ms
memory: 3960kb
Test #12:
score: 50
Accepted
time: 1ms
memory: 3848kb
Test #13:
score: 50
Accepted
time: 1ms
memory: 3988kb
Test #14:
score: 50
Accepted
time: 1ms
memory: 3984kb
Test #15:
score: 50
Accepted
time: 1ms
memory: 3900kb
Test #16:
score: 50
Accepted
time: 1ms
memory: 3988kb
Test #17:
score: 50
Accepted
time: 0ms
memory: 3904kb
Test #18:
score: 50
Accepted
time: 1ms
memory: 3964kb
Subtask #3:
score: 40
Accepted
Test #19:
score: 40
Accepted
time: 1ms
memory: 3960kb
Test #20:
score: 40
Accepted
time: 1ms
memory: 3840kb
Test #21:
score: 40
Accepted
time: 1ms
memory: 3992kb
Test #22:
score: 40
Accepted
time: 0ms
memory: 3940kb
Test #23:
score: 40
Accepted
time: 0ms
memory: 3960kb
Test #24:
score: 40
Accepted
time: 1ms
memory: 3828kb
Test #25:
score: 40
Accepted
time: 1ms
memory: 3892kb
Test #26:
score: 40
Accepted
time: 1ms
memory: 3960kb
Test #27:
score: 40
Accepted
time: 1ms
memory: 3968kb
Test #28:
score: 40
Accepted
time: 1ms
memory: 3984kb
Extra Test:
score: 0
Extra Test Passed