제출 #442719

#제출 시각아이디문제언어결과실행 시간메모리
442719The_Panonian_SailorT-Covering (eJOI19_covering)C++14
0 / 100
1 ms444 KiB
#include <iostream> #include <vector> using namespace std; int main() { long m,n; cin>>m>>n; vector<vector<int>> a; long k; int x,y; for(int i=0; i<m; i++) { for(int j=0; j<n; j++) { cin>>x; a[i].push_back(x); } } cin>>k; vector<int>r; vector<int>c; long zbir=0; for(int i=0; i<k; i++) { cin>>x>>y; r.push_back(x); c.push_back(y); } for(int i=0; i<k; i++) { if((r[i]==m-1 && c[i]==n-1) ||(r[i]==m-1 && c[i]==0) ||(r[i]==0 && c[i]==n-1) ||(r[i]==0 && c[i]==0)) { cout<<"No"<<endl; return 0; } else if(r[i]==0) { zbir+=a[r[i]][c[i]]+a[r[i]][c[i-1]] +a[r[i]][c[i+1]]+a[r[i+1]][c[i]]; } else if(r[i]==m-1) { zbir+=a[r[i]][c[i]]+a[r[i]][c[i-1]] +a[r[i]][c[i+1]]+a[r[i-1]][c[i]]; } else if(c[i]==0) { zbir+=a[r[i]-1][c[i]]+a[r[i]][c[i]] +a[r[i]+1][c[i]]+a[r[i]][c[i]+1]; } } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...