제출 #345766

#제출 시각아이디문제언어결과실행 시간메모리
345766daniel920712앵무새 (IOI11_parrots)C++14
81 / 100
7 ms1552 KiB
#include "encoder.h"
#include "encoderlib.h"
#include <vector>
#include <algorithm>
using namespace std; 

void encode(int N, int M[])
{
	vector < pair < int , int > > all2;
    int i,t=0;
    for(i=0; i<N; i++)
    {
    	send(M[i]);
    	send(M[i]);
    	send(M[i]);
    	send(M[i]);
    	all2.push_back(make_pair(M[i],i));
	}
	sort(all2.begin(),all2.end());
	for(i=0;i<N;i++) 
	{
		send(i/8*32+all2[i].second);
		send(i/8*32+all2[i].second);
		send(i%8*32+all2[i].second);
		//printf("%d %d\n",i/8*32,i%8*32);
		
	}
    
}
#include "decoder.h"
#include "decoderlib.h"
#include <map>
#include <vector>
#include <utility>
#include <algorithm>
using namespace std;

void decode(int N, int L, int X[])
{
    vector < int > all;
    map < int , int > con;
    int ans[305];
    int where[305];
    int i,j, b;
    for(i=0; i<L; i++)
    {
        con[X[i]]++;
    }

    for(auto i:con)
    {
        for(j=0;j<i.second/4;j++) all.push_back(i.first);
    }
    sort(all.begin(),all.end());
    for(i=0;i<N;i++) 
	{
		
		//printf("%d\n",all[i]);
		where[i]=0;
	}
    for(auto i:con)
    {
    	//printf("%d %d\n",i.first,i.second);
    	//if(i.second%4) printf("%d\n",i.first/32);
        if(i.second%4==2)
        {
            //printf("aa %d %d\n",i.first%32,i.first/32);
            where[i.first%32]+=i.first/32*8;
        }
        else if(i.second%4==1)
        {
        	//printf("bb %d %d\n",i.first%32,i.first/32);
        	where[i.first%32]+=i.first/32;
		}
		else if(i.second%4==3)
		{
			//printf("cc %d %d\n",i.first%32,i.first/32);
			where[i.first%32]+=i.first/32;
			where[i.first%32]+=i.first/32*8;
		}
    }
    /*for(i=0; i<N; i++)  printf("%d ",where[i]);
	printf("\n"); */
    for(i=0; i<N; i++) 
	{
		//printf("%d ",where[i]);
		output(all[where[i]]);
		//printf("%d\n",all[where[i]]);
	}
}


컴파일 시 표준 에러 (stderr) 메시지

encoder.cpp: In function 'void encode(int, int*)':
encoder.cpp:10:11: warning: unused variable 't' [-Wunused-variable]
   10 |     int i,t=0;
      |           ^

decoder.cpp: In function 'void decode(int, int, int*)':
decoder.cpp:13:9: warning: unused variable 'ans' [-Wunused-variable]
   13 |     int ans[305];
      |         ^~~
decoder.cpp:15:14: warning: unused variable 'b' [-Wunused-variable]
   15 |     int i,j, b;
      |              ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...