QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#446673#6389. TopicalsndCompile Error//C++141.5kb2024-06-17 14:58:492024-06-17 14:58:50

Judging History

你现在查看的是最新测评结果

  • [2024-06-17 14:58:50]
  • 评测
  • [2024-06-17 14:58:49]
  • 提交

answer

#include <bits/stdc++.h>
#define int long long
#define pp pop_back
#define pb push_back
#define eb emplace_back
#define nl cout "\n"
#define sp <<" "
#define spc <<" "<<
#define ff first
#define ss second
#define r0 return 0
#define INF INT_MAX
#define mod 998244353
#define MOD 1000000007
#define Yes cout << "YES" << endl
#define No cout << "NO" << endl
#define vi vector<int>
#define vll vector<ll>
#define vb vector<bool>
#define vd vector<double>
#define vs vector<string>
#define pii pair <int,int>
#define pll pair<ll,ll>
#define pls pair<ll,string>
#define psl pair<string,ll>
#define plc pair<ll,char>
#define pcl pair<char,ll>
#define pss pair<string,string>
#define pis pair<int,string>
#define sz size()
#define pause system("pause")
#define min3(a,b,c) min(a,min(b,c))
#define all(x) (x).begin(),(x).end()
#define deb(x) cout << #x << " - " << x << endl
using namespace std;
const int N=1000009;
vector <int> v;
pair <int, int> p[N];
inline void test_case(){
	int n, k;
	cin >> n >> k;
	int ans=0;
	for(int i=0; i<n; i++){
		cin >> p[i].ff;
	}
	for(int i=0; i<n; i++){
		cin >> p[i].ss;
	}
	sort(p, p+n);
	int sc=0;
	int ans=0;
	for(int i=0; i<n; i++){
		if(sc>=p[i].ff){
			ans++;
			sc+=p[i].ss;
		}
	}
	cout << ans;
}
signed main () {
    ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
    int T = 1;
    // cin >> T;
    while(T--) {
        test_case();
    }
    
    return 0;
}






Details

answer.code: In function ‘void test_case()’:
answer.code:51:13: error: redeclaration of ‘long long int ans’
   51 |         int ans=0;
      |             ^~~
answer.code:42:13: note: ‘long long int ans’ previously declared here
   42 |         int ans=0;
      |             ^~~