제출 #1066903

#제출 시각아이디문제언어결과실행 시간메모리
1066903MunkhErdeneA Plus B (IOI23_aplusb)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h>
#define ll long long
using namespace std;
#define no cout<<"NO"<<endl
#define yes cout<<"YES"<<endl
const ll mod=998244353;
#include "aplusb.h"
vector<int> smallest_sums(int, std::vector<int>arr1, std::vector<int>arr2){
	sort(arr1, arr1+n);
    sort(arr2, arr2+n);
    int g=0;
    int h=0;
	vector <int> result(100'000);
    for(int i=0 ; i<n ; i++){
		result[i]=arr1[g]+arr2[h];
        if(arr1[g+1]+arr2[h]>arr1[g]+arr2[h+1]){
            h++;
        }
        else{
            g++;
        }
    }
	return result;
}

/*void solve(){
    ll a, b, c, d, e, g, h, x, y, z, t, m, n, o, p, i, j, k,q,l,r;
    ll s = 0, niilber = 0, urjver = 1, opinion, element;
    ll aravt, zuut, negj, negjOld;
    string ug, ug1, ug2;
    float bt;
    char useg = 'a';
    bool bval = true, bval1 = false;
	cin>>n;
	ll arr[n];
	map<int,vector<int>> mp;
	for(int i=0;i<n;i++){
		cin>>arr[i];
		mp[arr[i]].push_back(i);
	}
	vector<vector<int>> vec;
	for(auto x:mp){
		vec.push_back(x.second);
	}
	sort(vec.begin(),vec.end());
	cin>>m;
	for(int i=0;i<m;i++){
		string ug;
		cin>>ug;
		if(ug.length()!=n){
			no;
			continue;
		}
		else{
			map<char,vector<int>> temp;
			for(int j=0;j<ug.length();j++){
				temp[ug[j]].push_back(j);
			}
			vector<vector<int>> vec1;
			for(auto x:temp){
				vec1.push_back(x.second);
			}
			sort(vec1.begin(),vec1.end());
			if(vec==vec1){
				yes;
			}
			else{
				no;
			}
		}
	}

}
int main() {
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	ll testCase=1;
	cin >> testCase;
	while (testCase--) {
        solve();
    }
}*/

컴파일 시 표준 에러 (stderr) 메시지

aplusb.cpp: In function 'std::vector<int> smallest_sums(int, std::vector<int>, std::vector<int>)':
aplusb.cpp:9:18: error: 'n' was not declared in this scope; did you mean 'yn'?
    9 |  sort(arr1, arr1+n);
      |                  ^
      |                  yn