답안 #100555

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
100555 2019-03-12T08:39:16 Z TAISA_ Memory 2 (JOI16_memory2) C++14
10 / 100
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(s[i]==ma){
					ans[id]=s[i];
					ans[i]=s[i];
					idx[s[i]].push_back(id);
					idx[s[i]].push_back(i);
					c+=2;
					continue;
				}
			    idx[s[i]].push_back(i);
				c++;
                ans[i]=s[i];
            }
        }
    }
    for(int i=0;i<N;i++){
        Answer(idx[i][0],idx[i][1],i);
    }
	return;
}
# 결과 실행 시간 메모리 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 3 ms 384 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 2 ms 256 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
8 Correct 3 ms 364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 256 KB Output is correct
2 Correct 3 ms 256 KB Output is correct
3 Correct 3 ms 256 KB Output is correct
4 Runtime error 3 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 256 KB Wrong Answer[3]
2 Halted 0 ms 0 KB -