Submission #300271

# Submission time Handle Problem Language Result Execution time Memory
300271 2020-09-17T03:36:45 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,ok,now;
	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++)
        {
            answer[i][0]=0;
            all.push_back(x[i][0]);
        }
        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++)
        {
            ok=0;
            now=m-1;
            for(j=0;j<k;j++)
            {
                if(ok||x[tt[i].where][j]==x[tt[n-i-1].where][m-1-j])
                {
                    ok=1;
                    t=now;
                    now--;
                }
                else t=j;
                ans+=x[tt[i].where][t]^x[tt[n-i-1].where][m-1-t];
                answer[tt[i].where][t]=j;
                answer[tt[n-i-1].where][m-1-t]=j;
            }
        }
    }
	allocate_tickets(answer);
	return ans;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 256 KB Contestant returned 298620960 but the tickets gives a total value of 846501984
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 256 KB Contestant returned 860858182 but the tickets gives a total value of 1018407370
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 256 KB Contestant returned 5 while correct return value is 6.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 256 KB Contestant returned 13 but the tickets gives a total value of 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 256 KB Contestant returned 13 but the tickets gives a total value of 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 256 KB Contestant returned 13 but the tickets gives a total value of 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 256 KB Contestant returned 298620960 but the tickets gives a total value of 846501984
2 Halted 0 ms 0 KB -