답안 #1050325

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1050325 2024-08-09T08:46:21 Z AlperenT_ 카니발 티켓 (IOI20_tickets) C++17
0 / 100
2 ms 6748 KB
#include "tickets.h"
#include <bits/stdc++.h>
 

#pragma GCC optimize("O3,unroll-loops")
#define pb push_back
#define F first
#define S second 
#define all(a) a.begin(),a.end()
#define pii pair <int,int>
#define ld long double 
#define ll long long
#define sz(v) (int)v.size()
#define rep(i , a , b) for(int i=a;i <= b;i++)
#define per(i, a , b) for(int i=a;i >= b;i--)
using namespace std ;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const int maxn = 2000 + 10  , sq = 333   , inf = 2e9 +100 , maxk = 2022 , mod = 1e9 + 7 ;
int n , m , a[maxn][maxn] , t[maxn] , c[maxn][maxn] , id[maxn] , c2[maxn][maxn] ; 
vector <pii> b[maxn] ; 

long long find_maximum(int k, vector< vector<int>> aa) {
    n = sz(aa) ;
    m = sz(aa[0]) ;
    vector <pair<int,pii> > vec ;
    rep(i ,0 , n-1){
        rep(j , 0 ,m-1){
            a[i][j] = aa[i][j] ;
            c[i][j] = -1 ;
            c2[i][j] = 0 ; 
            vec.pb({a[i][j] , {i,j}}) ; 
        }
    } 
    sort(all(vec)) ;
    int f = n*k/2 , sm =0 ; 
    per(i , sz(vec)-1 , 0){
        int x = vec[i].S.F , y = vec[i].S.S ;
        if(t[x] == k)continue ; 
        f--;
        t[x]++ ;
        c2[x][y] =1 ;
        sm += a[x][y] ;
        if(f==0)break ; 
    }
    f = n*k/2 ;
    rep(i ,0 , sz(vec)-1){
        int x = vec[i].S.F , y = vec[i].S.S ;
        if(t[x] == k)continue ; 
        f--;
        t[x]++;
        c2[x][y] = -1 ;
        sm -= a[x][y] ;
        if(f==0)break; 
    }
    rep(j , 0 ,k)t[j] = 0; 
    rep(i ,0 , n-1){
        vector <int> f , f2 ; 
        rep(j , 0 ,m-1){
            if(c2[i][j] == 1) 
            f.pb(j) ;
            if(c2[i][j] == -1)
            f2.pb(j) ;
        }
        vector <pii> az ;
        rep(j , 0 , k-1){
            az.pb({t[j],j});
        }
        sort(all(az)) ; 
        rep(j , 0 ,sz(f)-1){
            c[i][f[j]]= az[j].S ;
            t[az[j].S]++ ;
        }
        rep(j , 0, sz(f2)-1){
            c[i][f2[j]] = az[j+sz(f)].S ;
        }
    }
    vector <vector <int> > vec2 ;
    rep(i , 0 , n-1){
        vector <int> f ;
        rep(j , 0, m-1){
            f.pb(c[i][j]) ; 
        }
        vec2.pb(f) ; 
    }   
    allocate_tickets(vec2) ;
	return sm;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 4440 KB Output is correct
2 Correct 0 ms 4444 KB Output is correct
3 Correct 0 ms 4444 KB Output is correct
4 Incorrect 1 ms 6492 KB Contestant returned 18919508441 but the tickets gives a total value of 1739639257
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 4444 KB Output is correct
2 Incorrect 0 ms 4444 KB Contestant returned 2727881086 but the tickets gives a total value of -1567086210
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 4440 KB Contestant returned 4 while correct return value is 6.
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 4444 KB Output is correct
2 Correct 1 ms 4440 KB Output is correct
3 Incorrect 1 ms 4440 KB Contestant returned 24057831018 but the tickets gives a total value of -1711972758
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 4444 KB Output is correct
2 Incorrect 2 ms 6748 KB Contestant returned 39312626459 but the tickets gives a total value of 657920795
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 4444 KB Output is correct
2 Incorrect 2 ms 6748 KB Contestant returned 39312626459 but the tickets gives a total value of 657920795
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 4440 KB Output is correct
2 Correct 0 ms 4444 KB Output is correct
3 Correct 0 ms 4444 KB Output is correct
4 Incorrect 1 ms 6492 KB Contestant returned 18919508441 but the tickets gives a total value of 1739639257
5 Halted 0 ms 0 KB -