이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
//#include "grader.cpp"
#include "aliens.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pii pair<int,int>
#define OK puts("OK");
#define NO puts("NO");
#define YES puts("YES");
#define fr first
#define sc second
#define ret return
#define scanl(a) scanf("%lld",&a);
#define scanll(a,b) scanf("%lld %lld",&a, &b);
#define scanlll(a,b,c) scanf("%lld %lld %lld",&a,&b,&c);
#define scan1(a) scanf("%d",&a);
#define scan2(a,b) scanf("%d %d",&a, &b);
#define scan3(a,b,c) scanf("%d %d %d",&a,&b,&c);
#define all(s) s.begin(),s.end()
#define allr(s) s.rbegin()Ñ,s.rend()
#define pb push_back
#define sz(v) (int)v.size()
#define endi puts("");
#define eps 1e-12
ll n,m,k,ans;
bool vis[500001];
void changes(int &l,int &r){
while (vis[l] == 0 && l < m)l++;
while (vis[r] == 0 && r >= 0)r--;
}
ll take_photos(int n, int m, int k,vector<int> r,vector<int> c) {
int i,j;
::n = n;
::m = m;
bool f=1;
for (i=0;i<n;++i){
if (vis[r[i]] == 1){
n--;
}
vis[r[i]]=1;
vis[c[i]]=1;
}
int x = 0;
int y = m;
priority_queue <pair<ll,pair<ll,ll > >>q;
changes(x,y);
q.push({y-x+1,{x,y}});
while (f){
f=0;
int l = q.top().sc.fr;
int r = q.top().sc.sc;
q.pop();
int p = (l+r>>1);
int a = l;
int b = p;
changes(a,b);
if (a <= b){
q.push({b-a+1,{a,b}});
}
l = p+1;
r = r;
changes(l,r);
if (l <= r){
q.push({r-l+1,{l,r}});
f=1;
}
}
while (!q.empty()){
ans += q.top().fr*q.top().fr;
int l = q.top().sc.fr;
int r = q.top().sc.sc;
q.pop();
}
return ans;
}
컴파일 시 표준 에러 (stderr) 메시지
aliens.cpp: In function 'long long int take_photos(int, int, int, std::vector<int>, std::vector<int>)':
aliens.cpp:54:19: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
54 | int p = (l+r>>1);
| ~^~
aliens.cpp:72:13: warning: unused variable 'l' [-Wunused-variable]
72 | int l = q.top().sc.fr;
| ^
aliens.cpp:73:13: warning: unused variable 'r' [-Wunused-variable]
73 | int r = q.top().sc.sc;
| ^
aliens.cpp:33:11: warning: unused variable 'j' [-Wunused-variable]
33 | int i,j;
| ^
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |