2 solutions

  • 1
    @ 2025-8-29 14:58:23
    #include<bits/stdc++.h>
    using namespace std;
    int a[100010],b[100010],k;
    int main(){
    	int n,m,k;
    	cin>>n>>m>>k; 
    	for(int i=1;i<=n;i++)cin>>a[i];
    	for(int i=1;i<=n;i++)cin>>b[i];
    	for(int l=1,r=m;l<=n&&r>=1;){
    		if(a[l]+b[r]>k)r--;
    		else if(a[l]+b[r]<k)l++;
    		else{
    			cout<<l-1<<' '<<r-1;
    			return 0;
    		}
    	}
    	return 0;
    }
    
    

    Information

    ID
    2881
    Time
    1000ms
    Memory
    256MiB
    Difficulty
    5
    Tags
    # Submissions
    11
    Accepted
    3
    Uploaded By