1 solutions

  • 0
    @ 2025-9-29 17:48:45
    #include<bits/stdc++.h>
    using namespace std;
    struct Node{
    	int x,y,w;
    };
    int main()
    {
    	int n,m;
    	cin>>n>>m;
    	vector<Node> v;
    	for(int i=1;i<=n;i++)
    	{
    		for(int j=1;j<=m;j++)
    		{
    			int x;
    			cin>>x;
    			if(x!=0)
    			{
    				v.push_back({i,j,x});
    			}
    		}
    	}
    	for(auto t:v)
    	{
    		cout<<t.x<<" "<<t.y<<" "<<t.w<<endl;
    	}
    	return 0;
    }
    
    • 1

    Information

    ID
    151
    Time
    1000ms
    Memory
    256MiB
    Difficulty
    1
    Tags
    (None)
    # Submissions
    54
    Accepted
    26
    Uploaded By