求助!!就AC俩,剩下的全RE

B3662 [语言月赛202209] 山峰

吸氧了吗(o2)
by AlexSong @ 2024-01-31 10:47:47


先吸一下
by AlexSong @ 2024-01-31 10:48:11


@[AlexSong](/user/1004299) 开了,还是re
by weizekai @ 2024-01-31 11:15:02


```cpp #include<bits/stdc++.h> long long n,m,i,j,k,a[10000][10000],t,x,y,xx,yy,b[10000][2],ans; int main(){ std::cin>>n>>m; for(i=1;i<=n;i++) { for(j=1;j<=m;j++) { std::cin>>a[i][j]; } } std::cin>>t; for(i=1;i<=t;i++) { std::cin>>x>>y>>xx>>yy; std::swap(a[x][y],a[xx][yy]); } for(i=1;i<=n;i++) { for(j=1;j<=m;j++) { if(a[i][j-1]<a[i][j]&&a[i][j]>a[i][j+1]&&a[i][j]>a[i-1][j]&&a[i][j]>a[i+1][j]) { b[++ans][0]=i; b[ans][1]=j; } } } std::cout<<ans<<std::endl; for(i=1;i<=ans;i++) { std::cout<<b[i][0]<<" "<<b[i][1]<<std::endl; } return 0; }
by AlexSong @ 2024-01-31 11:31:20


@[weizekai](/user/1016066) 或者用C++17来写 ```cpp #include<bits/stdc++.h> using namespace std; int n, m, T, x1, x2, y_1, y2, cnt, a[1005][1005]; vector <pair<int, int>> vec; int main(){ ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); cin >> n >> m; for(int i = 1; i <= n; i ++) for(int j = 1; j <= m; j ++) cin >> a[i][j]; cin >> T; while(T --){ cin >> x1 >> y_1 >> x2 >> y2; swap(a[x1][y_1], a[x2][y2]); } for(int i = 1; i <= n; i ++) for(int j = 1; j <= m; j ++) if(a[i][j] > a[i - 1][j] && a[i][j] > a[i + 1][j] && a[i][j] > a[i][j - 1] && a[i][j] > a[i][j + 1]) vec.emplace_back(i, j), cnt ++; cout << cnt << '\n'; for(auto [u, v] : vec) cout << u << ' ' << v << '\n'; return 0; } ```
by dzsf_lhz @ 2024-02-25 14:22:19


~~不用吸氧~~
by dzsf_lhz @ 2024-02-25 14:23:43


|