답안 #320264

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
320264 2020-11-08T06:52:35 Z tasfiq4 질문 (CEOI14_question_grader) C++14
0 / 100
3 ms 656 KB
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int > pii;
typedef long long int lld;
#define pi acos(-1)
#define fr(i,m,n) for(i=m;i<n;i++)
#define fu(i,m,n) for(i=m;i>=n;i--)
#define vec vector<int>
#define pb push_back
#define pp pop_back()
#define ft first
#define sd second
#define all(v) v.begin(),v.end()
#define mom(ara) memset(ara,0,sizeof(ara));
#define m1m(ara) memset(ara,-1,sizeof(ara));
#define endl "\n"
#define eps 1.19209e-07
bool did=false;
int encode (int n, int x, int y) {
  vec code[1000];
  int mask,i,j,cnt=1,z;
  vec h;
    fr(i,0,12) if(i<6) h.pb(1);
			 else h.pb(0);
  if(!did){
  	do
  	{
	  	fr(i,0,12)
	  	{
  			code[cnt].pb(h[i]);
  		}
  		cnt++;
	  }while(next_permutation(all(h)));
	  did=true;
  }
  fr(i,0,12)
  {
  	if(code[x][i]==1 && code[y][i]==0) return i+1;
  }
}
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int > pii;
typedef long long int lld;
#define pi acos(-1)
#define fr(i,m,n) for(i=m;i<n;i++)
#define fu(i,m,n) for(i=m;i>=n;i--)
#define vec vector<int>
#define pb push_back
#define pp pop_back()
#define ft first
#define sd second
#define all(v) v.begin(),v.end()
#define mom(ara) memset(ara,0,sizeof(ara));
#define m1m(ara) memset(ara,-1,sizeof(ara));
#define endl "\n"
#define eps 1.19209e-07
bool did=false;
int decode (int n, int q, int h) {
  vec code[1000];
  int mask,i,j,cnt=1,z;
  vec g;
  fr(i,0,12) if(i<6) g.pb(1);
			 else g.pb(0);
  if(!did){
  	do
  	{
  		fr(i,0,12)
  		{
	  		code[cnt].pb(g[i]);
	  	}
	  	cnt++;
  	}while(next_permutation(all(g)));
  	did=true;
  }
  if(code[q][h-1]==1) return 1;
  else return 0;
}

Compilation message

encoder.cpp: In function 'int encode(int, int, int)':
encoder.cpp:21:7: warning: unused variable 'mask' [-Wunused-variable]
   21 |   int mask,i,j,cnt=1,z;
      |       ^~~~
encoder.cpp:21:14: warning: unused variable 'j' [-Wunused-variable]
   21 |   int mask,i,j,cnt=1,z;
      |              ^
encoder.cpp:21:22: warning: unused variable 'z' [-Wunused-variable]
   21 |   int mask,i,j,cnt=1,z;
      |                      ^
encoder.cpp:40:1: warning: control reaches end of non-void function [-Wreturn-type]
   40 | }
      | ^

decoder.cpp: In function 'int decode(int, int, int)':
decoder.cpp:21:7: warning: unused variable 'mask' [-Wunused-variable]
   21 |   int mask,i,j,cnt=1,z;
      |       ^~~~
decoder.cpp:21:14: warning: unused variable 'j' [-Wunused-variable]
   21 |   int mask,i,j,cnt=1,z;
      |              ^
decoder.cpp:21:22: warning: unused variable 'z' [-Wunused-variable]
   21 |   int mask,i,j,cnt=1,z;
      |                      ^
# 결과 실행 시간 메모리 Grader output
1 Runtime error 2 ms 492 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Runtime error 3 ms 656 KB Execution killed with signal 11 (could be triggered by violating memory limits)