답안 #44273

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
44273 2018-03-31T08:29:31 Z khohko Memory 2 (JOI16_memory2) C++17
0 / 100
2 ms 636 KB
#include <bits/stdc++.h>
//#include "grader.h"
#include "Memory2_lib.h"
#pragma GCC optimize("O3")
using namespace std;
#define ll long long
#define lol long long
#define pb push_back
//#define mp make_pair
#define fr first
#define sc second
#define MAX ((lol)(1e9+100))
#define MX ((lol)(4e9+100))
#define ARRS ((lol)(1e6+100))
#define MOD ((lol)(1e9+7))
#define EP ((double)(1e-9))
#define EPS ((double)(1e-8))
#define pb push_back
#define PI ((double)3.141592653)
#define LG 21




//void Answer(int I, int J, int X)
//int Flip(int I, int J)

ll f[300];
ll c[300];

void Solve(int t, int n){

    vector<ll> v;

    for(int i=0; i<2*n; i++)
        f[i]=-1;
    for(int i=0; i<2*n; i++)
        v.pb(i);

    while(v.size()){
        ll k=rand()%v.size();
        for(int i=0; i<n; i++)c[i]=0;
        for(int i=0; i<v.size(); i++){
            ll k=Flip(v[k],v[i]);
            f[i]=k;
            c[k]++;
        }
        ll pe=-1;
        for(int i=0; i<2*n; i++){
            if(c[i]>2)pe=i;
        }
        v.clear();
        for(int i=0; i<2*n; i++){
            if(f[i]==pe){
                f[i]=-1;
                v.pb(i);
            }
        }

    }

    for(int i=0; i<n; i++)
        for(int j=0; j<n; j++)
            if(f[i]==f[j])Answer(i,j,f[i]);
}


//
//int main(){
//    #ifdef KHOKHO
//        freopen("in.in","r",stdin);
//        freopen("out.out","w",stdout);
//    #endif // KHOKHO
//    cin>>n;
//
//}

Compilation message

memory2.cpp: In function 'void Solve(int, int)':
memory2.cpp:43:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for(int i=0; i<v.size(); i++){
                      ~^~~~~~~~~
memory2.cpp:41:12: warning: unused variable 'k' [-Wunused-variable]
         ll k=rand()%v.size();
            ^
memory2.cpp:44:26: warning: 'k' may be used uninitialized in this function [-Wmaybe-uninitialized]
             ll k=Flip(v[k],v[i]);
                          ^
# 결과 실행 시간 메모리 Grader output
1 Runtime error 2 ms 508 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 2 ms 636 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 2 ms 636 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -