# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
447360 | KDisabledA | Kronican (COCI16_kronican) | C++14 | 3 ms | 380 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
#include<ext/numeric>
#define fastIO ios::sync_with_stdio(0), cin.tie(NULL), cout.tie(NULL);
#define FOR(i, j, k, in) for (int i = (j); i < (k); i += (in))
#define FORW(i, j, k, in) for (int i = (j); i <= (k); i += (in))
#define RFOR(i, j, k, in) for (int i = (j); i >= (k); i -= (in))
#define RFORW(i, j, k, in) for (int i = (j); i > (k); i -= (in))
#define sz(arr) ((int)(arr).size())
#define pb push_back
#define fi first
#define se second
#define mp make_pair
using namespace std;
using namespace __gnu_cxx;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef pair<int,pii> piii;
typedef vector<pii> vii;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> vll;
typedef pair<ll,ll> pll;
typedef vector<pll> vpll;
const int inf=INT_MAX-(13*7);
const float PI=acos(-1);
const ll linf=LLONG_MAX-(13ll*7ll);
priority_queue<piii> pq;
const int N = 22;
int n,k,ed,res;
bool check[N][N];
int main(){
#ifndef ONLINE_JUDGE
freopen("dungdich.inp","r",stdin);
freopen("dungdich.out","w",stdout);
#endif // ONLINE_JUDGE
fastIO;
cin>>n>>k;
FORW(i,1,n,1){
FORW(j,1,n,1){
int w;
cin>>w;
if(i!=j&&!check[i][j]) {pq.push(mp(w,mp(i,j))); ++ed;}
check[i][j]=check[j][i]=1;
}
}
while(ed>k&&!pq.empty()){
res+=pq.top().fi;
pq.pop();
--ed;
}
cout<<res;
}
//-T nghi la t khong the de mat 1 nguoi ban tot nhu m dau =)))
//
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |