Submission #300253

# Submission time Handle Problem Language Result Execution time Memory
300253 2020-09-17T03:15:27 Z daniel920712 Carnival Tickets (IOI20_tickets) C++14
0 / 100
1 ms 256 KB
#include "tickets.h"
#include <vector>
#include <algorithm>
using namespace std;
vector < int > all;
struct A
{
    int where;
    int con;
}tt[1505];
bool F(A a,A b)
{
    return a.con<b.con;
}
vector < vector < int > > answer;
vector < int > row;
long long find_maximum(int k,vector< vector<int> > x)
{
	int n=x.size();
	int m=x[0].size();
	int i,j,t;
	long long ans=0;
	for(i=0;i<m;i++) row.push_back(-1);
	for(i=0;i<n;i++) answer.push_back(row);
	if(m==1)
    {
        for (int i=0;i<n;i++)
        {
            row[0]=0;
            all.push_back(x[i][0]);
            answer.push_back(row);
        }
        sort(all.begin(),all.end());
        for(i=0;i<n;i++) ans+=abs(all[i]-all[n/2]);
    }
    else
    {
        for(i=0;i<n;i++)
        {
            tt[i].where=i;
            for(j=0;j<m;j++) if(x[i][j]==1) break;
            tt[i].con=j;
        }
        sort(tt,tt+n,F);
        for(i=0;i<n/2;i++)
        {
            for(j=0;j<m;j++)
            {

                if(j%2==0) t=j/2;
                else t=m-1-t/2;
                ans+=x[tt[2*i].where][t]^x[tt[2*i+1].where][t];
                answer[tt[2*i].where][t]=j;
                answer[tt[2*i+1].where][t]=j;
            }
        }
    }

	allocate_tickets(answer);
	return ans;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 256 KB WA in grader: allocate_tickets called with parameter of wrong size
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 256 KB Ticket 0 of color 1 is played on invalid day 1
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 256 KB Ticket 0 of color 3 is played on invalid day 3
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 256 KB There is no ticket of color 0 on day 1
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 256 KB There is no ticket of color 0 on day 1
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 256 KB There is no ticket of color 0 on day 1
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 256 KB WA in grader: allocate_tickets called with parameter of wrong size
2 Halted 0 ms 0 KB -