输入
3
56 67 65
78 45 67
56 55 57
58
输出
yes 292
#include<iostream>
using namespace std;
const int N=100;
int main(){
int n,b,a[N][N];
cin>>n;
for(int i=0;i<n;i++){
for(int j=0;j<n;j++){
cin>>a[i][j];
}
}
cin>>b;
int sum=0;
int i=0,j=0;
while(i<n && j<n){
sum+=a[i][j];
if(b>=a[i][j])j++;
else i++;
}
if(j==n)cout<<"yes "<<sum<<endl;
else cout<<"no"<<endl;
return 0;
}