# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
100556 |
2019-03-12T08:46:51 Z |
TAISA_ |
None (JOI16_memory2) |
C++14 |
|
3 ms |
512 KB |
#include <bits/stdc++.h>
#include "Memory2_lib.h"
#define mp make_pair
#define all(vec) vec.begin(),vec.end()
using namespace std;
using ll=long long;
using P=pair<ll,ll>;
const ll INF=1LL<<30;
const ll LINF=1LL<<60;
const double eps=1e-9;
const ll MOD=1000000007LL;
template<typename T>void chmin(T &a,T b){a=min(a,b);};
template<typename T>void chmax(T &a,T b){a=max(a,b);};
int dx[4]={0,1,0,-1};
int dy[4]={1,0,-1,0};
void Solve(int T,int N){
vector<int> ans(2*N,-1);
vector<vector<int>> idx(N);
int id=0;
int c=0;
while(c<2*N){
vector<int> s(2*N,-1),co(2*N);
int en=-1,ma=-1;
for(int i=0;i<2*N;i++){
if(i==id)continue;
if(ans[i]!=-1)continue;
int k=Flip(id,i);
chmax(ma,k);
co[k]++;
if(co[k]>2){
ans[id]=k;
c++;
idx[k].push_back(id);
en=k;
id=i;
break;
}
s[i]=k;
}
for(int i=0;i<2*N;i++){
if(s[i]!=en&&s[i]!=-1){
if(en==-1){
ans[i]=s[i];
idx[s[i]].push_back(i);
c+=2;
continue;
}
idx[s[i]].push_back(i);
c++;
ans[i]=s[i];
}
}
if(en==-1){
for(int i=0;i<N;i++){
if(idx[i].size()==1){
idx[i].push_back(id);
}
}
}
}
for(int i=0;i<N;i++){
Answer(idx[i][0],idx[i][1],i);
}
return;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
384 KB |
Output is correct |
2 |
Correct |
2 ms |
256 KB |
Output is correct |
3 |
Correct |
2 ms |
256 KB |
Output is correct |
4 |
Correct |
2 ms |
384 KB |
Output is correct |
5 |
Correct |
3 ms |
256 KB |
Output is correct |
6 |
Correct |
2 ms |
256 KB |
Output is correct |
7 |
Correct |
2 ms |
384 KB |
Output is correct |
8 |
Correct |
2 ms |
256 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
384 KB |
Output is correct |
2 |
Correct |
3 ms |
384 KB |
Output is correct |
3 |
Correct |
2 ms |
384 KB |
Output is correct |
4 |
Incorrect |
3 ms |
384 KB |
Wrong Answer[3] |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
384 KB |
Output is correct |
2 |
Correct |
2 ms |
256 KB |
Output is correct |
3 |
Correct |
2 ms |
384 KB |
Output is correct |
4 |
Correct |
2 ms |
384 KB |
Output is correct |
5 |
Runtime error |
3 ms |
512 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
6 |
Halted |
0 ms |
0 KB |
- |